On Dec 06, 2006, at 22:25 UTC, Bob Jackman wrote: > I would like to use A as a Factory to create the correct C1 or C2 subclass.
Then you'll need to put a Shared Method in the A class to serve as the factory. > dim x as new A(par1, par2) //where par1 and par2 are some parameters > > How can I do this in the constructor of A? You can't. This code very clearly tells the compiler to create a new A object, not some subclass of A, so that's what it'll do. > However I would then like to call a method like > > AArray(0).Foo(para1) > > where Foo is defined in C1 and C2. The right C1 Foo or C2 Foo would be > called based on which class was instantiated from the proper process in > Question 1. That's no problem, provided you have defined Foo in class A. Otherwise, Foo isn't something all A's can do, so the compiler (quite rightly) won't let you attempt to do it. > Just to clarify Foo is defined in C1 and C2 and Foo is not defined in A. Well, there's the problem then. Best, - Joe -- Joe Strout -- [EMAIL PROTECTED] Verified Express, LLC "Making the Internet a Better Place" http://www.verex.com/ _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html>
