首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

初学者~为什么运行有有关问题。

2012-05-04 
菜鸟求助~为什么运行有问题。。。//这是类#includeiostream#includestringusing namespace stdclassPay{

菜鸟求助~为什么运行有问题。。。
//这是类
#include<iostream>
#include<string>
using namespace std;
class Pay
{
public:
void input()
{
cout<<"Please input the num:";
cin>>num;
  cout<<"Please input the name:";
cin>>name;
}
void display()
{
cout<<"num:"<<num<<endl;
cout<<"name:"<<name<<endl;
cout<<"salary:"<<salary<<endl;
}
protected:
int num;
string name;
  int salary;
};
//继承派生
#include"class.h"
class Manager:virtual public Pay
{
public:
void calculate()
{
salary=8000;
}
};
//主函数
#include"inheritance.cpp"
int main()
{
Manager m1;
m1.input;
m1.display;
return 0;
}

[解决办法]
m1.input();
m1.calculate();
m1.display();

热点排行