Home > Back-end >  Why are there an error
Why are there an error

Time:10-19


Here I copied in vs 2019 again, why I am here is announced, prompt error of part is not CBox base class, but I look like source program

CodePudding user response:

CBox class does not define a member variable
Int m_Length, m_width m_Height;
Add the code above to the public: below ~ CBox () above, also is the first member variable declaration

CodePudding user response:

Make that a string of braces, into the brackets

CodePudding user response:

You have so few mistakes:
1, lack a few member variables defined, such as: double m_Length, m_width, m_Height;
2, the constructor without the body of the function, the error is fatal, you should write like this:
 class CBox {
Double m_Length, m_width m_Height;
Public:
Explicit CBox (double lv=1.0, double wv=1.0, double hv=1.0)
M_width: m_Length {lv}, {wv}, m_Height {hv}//initialization list can also use parentheses here, no problems with the curly braces
{//have you missed here function body
}
};
  • Related