• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
一蓑烟雨
C/C++,Linux,语音技术
博客园    首页    新随笔    联系   管理    订阅  订阅
2012年8月16日
const方法
摘要: 1、先看下一个类Test.h 1 #define PI 3.14159 2 const int NUM = 3;//定义常量 3 class Test 4 { 5 public: 6 Test(); 7 virtual ~Test(); 8 virtual void action(const int input);//保护,防止意外修改 9 int getstate() const;10 const MyClass istate();11 private:12 static int mLay;13 ... 阅读全文
posted @ 2012-08-16 11:39 lovemu 阅读(1379) 评论(0) 推荐(0)
static--静态方法与静态成员
摘要: 1、Test.h 1 class Test 2 { 3 public: 4 Test(); 5 virtual ~Test(); 6 virtual void action(); 7 static virtual void go(); 8 private: 9 static int mLay;10 int mOut;11 12 };此处,static 与 virtual不能共用,此时这里去掉virtual关键字。2、Test.h 1 class Test 2 { 3 public: 4 Test(... 阅读全文
posted @ 2012-08-16 10:00 lovemu 阅读(351) 评论(0) 推荐(0)
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3