using namespace std;
The class Box
{
Private:
Int heigh.
Int weigh;
int length;
Public:
The Box ();//this is no form of the constructor parameters
Box (int int h, w, int len) : heigh (h) and weigh (w), length (len) {}//this is a form of the constructor parameters and
//this is used for initialization parameter list
Int volume ();
//this is for a member function declaration
};
Box: : Box ()//it is to define a constructor
{
Heigh=10;
Weigh=11;
Length=12;
}
//int Box: : volume ()
Int Box: : volume ()
{
Return (height * width * length);
}
Int main ()
{
Box Box;//the object is to define the
Cout & lt; <"The volume is" & lt;
Cout & lt; <"THE VOULMEIS" & lt;
}
error:
CodePudding user response:
There are whole Angle of punctuationCodePudding user response:
I put the volume function inside the class definition is ok, if is not in the definition would say "non-static data is stored inside the class definition"