SUMMARY
This chapter covered the principal ideas involved in using inheritance.
You have now gone through all of the important language features of C++. It’s important that you feel comfortable with the mechanisms for defining and deriving classes and the process of inheritance. Windows programming with Visual C++ involves extensive use of all these concepts.
class CBird
{
protected:
int wingSpan;
int eggSize;
int airSpeed;
int altitude;
public:
virtual void fly() { altitude = 100; }
};
class CBase
{
protected:
int m_anInt;
public:
CBase(int n): m_anInt(n) { std::cout << "Base constructor\n"; }
virtual void Print() const = 0;
};
Get Ivor Horton's Beginning Visual C++ 2012 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.