topical media & game development
basic-program-solutions-09-Soln9-3.c
? /
basic-program-solutions-09-Soln9-3.c
// Soln 9_3.cpp
include <iostream>
using std::cout;
using std::endl;
class CBase
{
protected:
int m_anInt;
public:
CBase(int n) : m_anInt(n) { cout << "Base constructor" << endl; }
virtual void Print() = 0;
};
class CDerived : public CBase
{
public:
CDerived(int n) : CBase(n) { cout << "Derived constructor" << endl; }
void Print() { cout << "value is " << m_anInt << endl; }
};
int main()
{
CDerived d(3);
d.Print();
return 0;
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.