The default constructor is not provided.Displayed(IncludingNo ParametersAndDefault parametersIs used to create object constructor.
Constructor used for the following declaration
Stock stock1;
Note:
The compiler provides the default constructor only when no constructor is defined,
When we define constructors, we must provide Default constructors, such
Stock (const char * CO, int N, double pr); this is a constructor, but it is not the default constructor. If we do not provide the default constructor, this will cause an error.
There are two constructor types to complete:
1. Function overload. constructor without Parameters
Stock (){}
2. provide default values for all parameters of an existing constructor.
Stock (const char * CO = "error", int n = 0, double pr = 0.0 );
BecauseOnly one default constructor can be created., SoThe above two Default constructors cannot be used at the same time
After you create a default constructor using any of the above methods, you can declare the object variables without initializing them:
Do not use the default constructor for implicit call ();
Stock stock1; // call the default constructor implicitly