Home > Back-end >  Beginners about using vs2013 c, I written in devc_c is no problem
Beginners about using vs2013 c, I written in devc_c is no problem

Time:09-24

# include

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; Box box1 (15, 30, 13);
Cout & lt; <"THE VOULMEIS" & lt; return 0;
}
error:

CodePudding user response:

There are whole Angle of punctuation

CodePudding 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"
  • Related