程序错误,提示fatal error LNK1169: 找到一个或多个多重定义的符号,帮忙找错
#include<iostream>usingnamespacestd;classRectangle{protected:floatLength;floatWidth;p...
#include<iostream>
using namespace std;
class Rectangle
{
protected:
float Length;
float Width;
public:
Rectangle(float a,float b)
{
Length=a;
Width=b;
}
float Area()
{
return(Length*Width);
}
};
class Cuboid: public Rectangle
{
private:
float High;
float Volume;
public:
Cuboid(float a,float b,float c):Rectangle(a,b)
{
High=c;
}
float Vol()
{
Volume=Area()*High;
return(Volume);
}
void Show()
{
cout<<"长方体的宽是:"<<Width<<"\n长方体的长是:"<<Length<<"\n长方体的高是:"<<High
<<"\n长方体的体积是:"<<Volume<<endl;
}
};
#include"2011.11.04.1.h"
void main()
{
Cuboid cub(10,20,30);
cub.Vol();
cub.Show();
system("pause");
} 展开
using namespace std;
class Rectangle
{
protected:
float Length;
float Width;
public:
Rectangle(float a,float b)
{
Length=a;
Width=b;
}
float Area()
{
return(Length*Width);
}
};
class Cuboid: public Rectangle
{
private:
float High;
float Volume;
public:
Cuboid(float a,float b,float c):Rectangle(a,b)
{
High=c;
}
float Vol()
{
Volume=Area()*High;
return(Volume);
}
void Show()
{
cout<<"长方体的宽是:"<<Width<<"\n长方体的长是:"<<Length<<"\n长方体的高是:"<<High
<<"\n长方体的体积是:"<<Volume<<endl;
}
};
#include"2011.11.04.1.h"
void main()
{
Cuboid cub(10,20,30);
cub.Vol();
cub.Show();
system("pause");
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询