A general declaration for all inherited classes
        Posted  
        
            by Soham
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Soham
        
        
        
        Published on 2010-04-24T04:51:14Z
        Indexed on 
            2010/04/24
            4:53 UTC
        
        
        Read the original article
        Hit count: 274
        
c#
|inheritance
Consider, there is a class called SuperClass from which, ClassA, ClassB, ClassC is derived. From each one of those derived Classes, there are further more two classes are derived each called ChildClassAA and ChildClassAB[AB stands for Bth Child class from the Ath Class.Lets not really pull our hair on this nomenclature].
Now, ideally, I want to declare a general type as a private member of another Class say IndependentClass which can be initialized during run time as either of the objects of type ClassAor ClassB or ClassC and even the derived classes like ClassAA or ClassAB.
Is there a possible way to do it?
© Stack Overflow or respective owner