473,396 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Inheritance at executing time

Hi folks,
I donīt know if this is possible. I want to make a class inheritance while
my program is running, depending on my userīs data.

Can I do this? Any ideas?

Thanks!
Jul 24 '06 #1
4 1037
"André Nobre" <no@spam.comwrote:
I donīt know if this is possible. I want to make a class inheritance while
my program is running, depending on my userīs data.

Can I do this? Any ideas?
Sure, using System.Reflection.Emit you can dynamically create an
assembly and create a new type that inherits from a given type.

-- Barry

--
http://barrkel.blogspot.com/
Jul 24 '06 #2
Hi,

In theory you can , using Reflection, but may I ask the reason why you want
to do this?

I would guess you want some kind of Factory pattern.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"André Nobre" <no@spam.comwrote in message
news:eX*************@TK2MSFTNGP04.phx.gbl...
Hi folks,
I donīt know if this is possible. I want to make a class inheritance while
my program is running, depending on my userīs data.

Can I do this? Any ideas?

Thanks!

Jul 24 '06 #3

Depending on the type of my user Iīll need to instanciate a class. In my
architeture, I donīt want to use Interfaces in this case (and it wonīt have
any meaning if I use it..) and I donīt want to agrupate all atributes from
one type and othes in the same class, and just use a some of them.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.uswrote
in message news:eb**************@TK2MSFTNGP02.phx.gbl...
Hi,

In theory you can , using Reflection, but may I ask the reason why you
want to do this?

I would guess you want some kind of Factory pattern.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"André Nobre" <no@spam.comwrote in message
news:eX*************@TK2MSFTNGP04.phx.gbl...
>Hi folks,
I donīt know if this is possible. I want to make a class inheritance
while my program is running, depending on my userīs data.

Can I do this? Any ideas?

Thanks!


Jul 24 '06 #4
Hi,
"André Nobre" <no@spam.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>
Depending on the type of my user Iīll need to instanciate a class. In my
architeture, I donīt want to use Interfaces in this case (and it wonīt
have any meaning if I use it..) and I donīt want to agrupate all atributes
from one type and othes in the same class, and just use a some of them.
This is a common escenario for a Factory pattern. depending of some criteria
you instantiate a different type.

Contrary to your opinion though you should use a common interface. In case
that some types use functionality that others dont you should always ask if
a particular instance implement the expected interface using the "as"
operator.

--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jul 25 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: JKop | last post by:
I'm starting to think that whenever you derive one class from another, that you should use virtual inheritance *all* the time, unless you have an explicit reason not to. I'm even thinking that...
0
by: apb18 | last post by:
A bit of query plan strangeness. Suppose you have an inheritance tree such that the columns 'ID' and 'field' appear in the top level table, call that table XXX. tables YYY and ZZZ both inherit...
14
by: Steve Jorgensen | last post by:
Recently, I tried and did a poor job explaining an idea I've had for handling a particular case of implementation inheritance that would be easy and obvious in a fully OOP language, but is not at...
12
by: Steve Jorgensen | last post by:
The classing Visual Basic and VBA support for polymorphism, let's face it, is a bit on the weak side, and built-in support for inheritance is non-existent. This little essay is about some patterns...
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
45
by: Ben Blank | last post by:
I'm writing a family of classes which all inherit most of their methods and code (including constructors) from a single base class. When attempting to instance one of the derived classes using...
0
by: Malcolm Allard | last post by:
Hi, I'm new to the world of Visual Studio .Net (but have done a fair bit of VB6 coding). I'm playing with the sample RS232 code from the MSDN website...
60
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the...
2
by: yulam4u | last post by:
hello people!!! i am having this problem while i am implementing inheritance in a package named"inherint" which is a sub-directory of the directory "shashikayubbi"!!! i've a super class...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.