Extend a base class during runtime

G

Guest

Hi,

I have two classes, a base clase ItemType and a class which inherits from it
called Item. During the runtime of my program, I create an instance of
ItemType, then later, I would like to extend it into an object of class Item.
What is the best practice to extend the base class object into a class that
inherits from it?

Thanks,

James
 
M

Michael S

James said:
Hi,

I have two classes, a base clase ItemType and a class which inherits from
it
called Item. During the runtime of my program, I create an instance of
ItemType, then later, I would like to extend it into an object of class
Item.
What is the best practice to extend the base class object into a class
that
inherits from it?

Thanks,

James

You can accomplish this by using CodeDOM.
But why on earth would you want to do such a thing? Do you hate maintainers?
=)

Tell us more...

- Michael S
 
C

Colin Stutley

Similar question, and a "How" for Michael,

Using the strong typed dataset generator - instead of the generator
producing code from the xml schema file, and that code being used within the
VStudio IDE (intelisense, compiler etc), would it be possible to have a base
class which emitted nested methods based on the contents of the xml file
(without producing the intermediate code).

For example: I select the "MySchema" data control and drop it on my form. On
the property grid of 'MySchema' I enter a path to an xml file, this file is
read when the property is set. 'MySchema' then emits a new set of methods
that can be detected by the VStudio intelisence and by the compiler (this is
the tricky part).

- Colin
 
A

Aleksandar

Hello

class Item : ItemType
{

...

public Item(ItemType it)
{
// do something
}

...

}

ItemType it = new ItemType();
Item i = new Item(it);


Aleksandar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top