<<< Constructors     Index     Default constructors >>>

4. Sub-object constructors


  • 
    class Cylinder {};
    class Transmission {};
    class Wheel {};
    
    class Engine {
    	Cylinder     m_cylinder[ 2 ];
    };
    
    class Moped {
    	Engine       m_engine;
    	Transmission m_transmission;
    	Wheel        m_wheel[ 2 ];
    };
    
    int main()
    {
        Moped honda;
        return 0;
    }
    
    
    C++ constructors chain

<<< Constructors     Index     Default constructors >>>