⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 soln9_3.cpp

📁 Wrox.Ivor.Hortons.Beginning.Visual.C.Plus.Plus.2008 With sourcecode
💻 CPP
字号:
// Soln 9_3.cpp
/*
  CBase is an abstract class becasue it cotains the pure virtual function Print().
*/
#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;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -