摘要:
. class Myclass { public: virtual int FuncX(); virtual int FuncY(); }; int main() { Myclass obj; // 编译报错 cout << "hello" << endl; return 0; } class My 阅读全文
posted @ 2020-10-03 22:33
一匹夫
阅读(329)
评论(0)
推荐(0)
摘要:
const int f[10] = { 1,2,3,4,5,6,7,8,9,10 }; int main() { // test1 const int i = 3; int& j = const_cast<int&>(i); // 使用const_cast关键字进行强制类型转换 j = 5; // 阅读全文
posted @ 2020-10-03 21:22
一匹夫
阅读(517)
评论(0)
推荐(0)
摘要:
1. 多态初体验 #include <iostream> #include <string> using namespace std; class Parent { public: virtual void print() { cout << "I'm Parent." << endl; } }; 阅读全文
posted @ 2020-10-03 20:43
一匹夫
阅读(260)
评论(0)
推荐(0)
摘要:
1. 重载指针访问符 初体验 #include <iostream> using namespace std; class test { public: test(int input) :num(input), j(input) {} ~test() {} int operator * () con 阅读全文
posted @ 2020-10-03 17:42
一匹夫
阅读(155)
评论(0)
推荐(0)