C++的小问题!! 麻烦了大大了
class Manager:public Employee{public:
Manager(string Name,string id,float s=0.0):Employee(Name,id){
WeeklySalary=s;
}
这段代码中 上面的Manager继承Employee 那个 下面的Public:中的内容是什么意思?构造函数的继承??
追问:#include<iostream>
using namespace std;
class TwoCoor
{
private:
double x,y;
public:
TwoCoor(int a=0,int b=0)
{
x=a;y=b;
}
friend TwoCoor operator+(TwoCoor a,TwoCoor b);
friend TwoCoor operator-(TwoCoor a,TwoCoor b);
friend TwoCoor &operator<<(ostream &os,TwoCoor &s);
friend TwoCoor &operator>>(istream &is,TwoCoor &s);
friend double distcount(TwoCoor a,TwoCoor b);
};
TwoCoor operator+(TwoCoor a,TwoCoor b)
{
TwoCoor i;
i.x=a.x+b.x;
i.y=b.x+b.y;
return i;
}
TwoCoor operator-(TwoCoor a,TwoCoor b)
{
TwoCoor i;
i.x=a.x-b.x;
i.y=a.y-b.y;
return i;
}
TwoCoor discount(TwoCoor a,TwoCoor b)
{double x=(a.x-b.x);
double y=(b.y-b.y);
double i=sprt(x*x+y*y);
return i;
}
TwoCoor &operator<<(ostream &os,TwoCoor &s);
{
os<<"(<<s.x<<","<<s.y<<)";
return s;
}
TwoCoor &operator>>(instream &is,TwoCoor &s)
{
is>>x.y>>s.y;
return s;
}
void main()
{
TwoCoor m,n,a1,a2;
double a1;
cout<<"请输入两点的坐标"<<endl;
cout<<"请输入X"<<endl;
cin>>m;
cout<<"请输入y"<<endl;
cin>>n;
cout<<"m="<<m<<endl;
cout<<"n="<<n<<endl;
cout<<"两点坐标运算+:"<<endl;
a1=m+n;
cout<<"a1="<<a1<<endl;
cout<<"两点减运算-:"<<endl;
a2=m-n;
cout<<"a2="<<a2<<endl;
cout<<"两点的之间的距离"<<endl;
cout<<"a3="<<distcount(m,n)<<endl;
}
能帮我看下这断程序的问题么?