06 2011 档案
摘要:● Meaning “many forms”, polymorphism in OO terminology means a single statement in codethat might do different things depending on the context in which it isexecuted. ○ In thiscase, rpt[i]->Display() is a polymorphic call (when Display() is a virtual function). ○ Dependingon what kind of object w
阅读全文
摘要:1 #include <iostream> 2 #include <string> 3 using namespace std; 4 5 #define DEBUGBUILD 0 6 #define DEBUG if (DEBUGBUILD) cout 7 8 class Date { 9 private: 10 int day; 11 int month; 12 int year; 13 public: 14 Date() { DEBUG << "Date: default ctor" << endl; } 15 Date(
阅读全文
摘要:1 #include <iostream> 2 #include <string> 3 using namespace std; 4 5 #define DEBUGBUILD 0 6 #define DEBUG if (DEBUGBUILD) cout 7 8 class Date{ 9 private: 10 int day, month, year; 11 public: 12 Date(){ DEBUG << "Date: default ctor" << endl;} 13 Date(int m, int d, int
阅读全文
浙公网安备 33010602011771号