# include "stdafx. H"
#include
using namespace std;
The class Car
{
Public:
Virtual void Drive () {cout<" O "& lt;
The class Benz: public Car
{
Public:
Virtual void Drive () {
cout <"Benz - comfortable" & lt;
};
The class BMW: public Car
{
Public:
Virtual void Drive () {
cout <"BMW - control" & lt;
};
Void Test ()
{
The Car * pcar.
Pcar - & gt; Drive ();
Car * pBenz=new Benz.
PBenz - & gt; Drive ();
The Car * pBMW=new BMW;
PBMW - & gt; Drive ();
}
Int main ()
{
The Test ();
system("pause");
return 0;
}
CodePudding user response:
The Car * pcar=new Car ();Pcar - & gt; Drive ();
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
- a delicate small tail -- -- --
https://bbs.gnsoft.ltd
-------------------------