摘要: virtual :虚函数修饰词,可以实现多态机制。 1 class joker{ 2 public: 3 virtual void print()=0; 4 }; 5 class joker1:public joker{ 6 public: 7 void print()override{ 8 cou 阅读全文
posted @ 2021-12-20 17:52 joker_2255 阅读(60) 评论(0) 推荐(0)
摘要: const :常量修饰词 const 在函数前后修饰的意义 const在前修饰 禁止作为左值使用 const在后修饰 只用在类成员函数上,该函数只能访问const 成员函数,并且访问的成员变量不能改变其值。 const 修饰virtual const修饰成员函数,也是函数重载一种范畴,加入继承jok 阅读全文
posted @ 2021-12-20 10:33 joker_2255 阅读(49) 评论(0) 推荐(0)