#include <iostream.h>
class A
{
public:
void f1()
{
cout<<"class A f1"<<endl;
}
virtual void f2()
{
cout<<"class A f2"<<endl;
}
virtual void f3()=0;
};
class B : public A
{
public:
void f1()
{
cout<<"class B f1"<<endl;
}
void f2()
{
cout<<"class B f2"<<endl;
}
void f3()
{
cout<<"class B f3"<<endl;
}
};
int main()
{
A *m_j=new B();
m_j->f1();
m_j->f2();
m_j->f3();
delete m_j;
return 0;
}
类:
继承:
虚函数:
纯虚拟函数:
抽象类:
重载:
覆盖:
多态:
文章评论(0条评论)
登录后参与讨论