home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
m
/
mar93.zip
/
1103108A
< prev
next >
Wrap
Text File
|
1993-01-08
|
527b
|
49 lines
#include <iostream.h>
class B
{
public:
void f();
void g();
void h();
};
void B::f() { cout << "B::f()\n"; }
void B::g() { cout << "B::g()\n"; }
void B::h() { cout << "B::h()\n"; }
class D : public B
{
public:
void g();
void h();
};
void D::g()
{
B::g();
cout << "... called from D::g()\n";
}
void D::h()
{
((B *)(this))->h();
cout << "... called from D::h()\n";
}
int main()
{
B b;
b.f();
b.g();
b.h();
D d;
d.f();
d.g();
d.h();
return 0;
}