×

Loading...

See whether this implement what you want:

clinux (C/Linux)
derived.cpp
#include "Base.h"
class Derived : public Base
{
public:
void did(){cout << "this is derived class" << endl;
cout << "tt = " << getTT() << endl;}
private:
};

base.cpp
#include <iostream.h>
class Base
{
public:
int getTT() { return tt;}
virtual void did(){};
private:
int tt;
};

int main()
{
Base *b = new Derived;
b->did();
return 0;
}
(#346386@0)
2002-1-24 -04:00
This post has been archived. It cannot be replied.
Page address has been copied. To share, click to copy page address.
Share Online by QR Code

Back To Topic: 问一个C++的问题

Back To Forum: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论