When the following occurs
1.A C++ class 'class1' contains a member of class 'class2,'
and
2.You want to construct an object of type 'class1' (but not from another object of type 'class1'). There must be a constructor class2::class2() so that the member can be constructed.
This constructor without parameters is called the default constructor.
The compiler will supply a default constructor automatically unless you have defined any constructor for class 'class2'.
In that case, the compiler will not supply the default constructor automatically ( you must supply one.
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|