64,649
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include "stdafx.h"
#include <iostream>
using namespace std;
class statement
{
public:
virtual void create_(int a)=0; //参数表必须一直,如果不实现,则设置为纯虚函数
};
class state_read:public statement
{
void create_(int a){cout <<a <<endl;}
};
int main()
{
statement *p;
p=new state_read;
p->create_(3);
return 0;
}
#include <iostream>
using namespace std;
class statement
{
public:
virtual void create_(int i)=0;
};
class state_read:public statement
{
public:
void create_(int a){cout <<a <<endl;}
};
int main()
{
statement *p;
p=new state_read();
p->create_(3);
return 0;
}
#include <iostream>
using namespace std;
class statement
{
public:
virtual void create_(int a){}; //把基类的这个函数补全
};
class state_read:public statement
{
public:
void create_(int a){cout <<a <<endl;} //从statement类继承过来的!
};
int main()
{
statement *p;
p=new state_read;
p->create_(3);
system("pause");
return 0;
}
#include <iostream>
using namespace std;
class statement
{
public:
virtual void create_(int);
};
class state_read:public statement
{
void create_(int a){cout < <a < <endl;}
};
int main()
{
statement *p;
p=new state_read;
p->create_(3);
return 0;
}