H
Henrik Dahl
Hello!
I have a typical GoF Composite Pattern. It means an abstract Component class
and two concrete classes Primitive and Composite.
In my DoDragDrop() method call I'll therefore pass an object reference to
either an instance of Primitive or of Composite.
To my Data.GetData() I would obviously like to be able to pass the type of
the abstract base class: Data.GetData(TypeOf(Component)), but this returns
null despite the Data object actually contains an instance of Composite.
How do I make this simple ordinary case to work, i.e. how do I obtain an
instance of any subclass of a given base class?
Best regards,
Henrik Dahl
I have a typical GoF Composite Pattern. It means an abstract Component class
and two concrete classes Primitive and Composite.
In my DoDragDrop() method call I'll therefore pass an object reference to
either an instance of Primitive or of Composite.
To my Data.GetData() I would obviously like to be able to pass the type of
the abstract base class: Data.GetData(TypeOf(Component)), but this returns
null despite the Data object actually contains an instance of Composite.
How do I make this simple ordinary case to work, i.e. how do I obtain an
instance of any subclass of a given base class?
Best regards,
Henrik Dahl