我是刚刚近来的,看一看你们的智慧吧
#include<iostream.h>
class Box
{
public:
Box(int=10,int=10,int=10);
int volume();
private:
int height;
int width;
int length;
};
Box::Box(int h,int w,int len)
{
height=h;
width=w;
length=len;
}
int Box::volume()
{
return(height*width*length);
}
int main()
{
Box box1(15,30,25),Box2;
cout<<"The volume of box is"<<box1.volume<<endl;
box2=box1;
cout<<"The volume of box is"<<box2.volume<<endl;
return 0;
}
这是原代码呀!但是我不知道什么地方错呀!希望你们能解决一下吧