|
[分享]分享一下WinHex.17.3.SR-5的最新版
带中文语言不? |
|
请管理员将帖子删除了吧
关键是,类B只写方法,不写方法的实现,哪怕是重名的方法,都不会连接到类A中,必须重写所有方法…… |
|
请管理员将帖子删除了吧
其实也不是屏蔽死,只是用户直接面向的是类B,而非类A,虽说他可以去类A看所有方法,但因类A太复杂,大家都不想看 |
|
|
|
请管理员将帖子删除了吧
我原来也是这样用的,这个问题就是让别人直接new A了,我是不想让他们看到A而已,所以我搞了个B把A包起来,告诉他们只用B,呵呵 不过可能C++里没有办法实现我说的这种奇怪的需求 |
|
请管理员将帖子删除了吧
嗯,比如? |
|
请管理员将帖子删除了吧
派生类写出来的方法都是基类里public的, 我的问题不是访问方法工成员的问题,而是希望派生类写了方法声明,但不用写实现,希望它直接指向基类的实现,因为方法都仅仅是一个指针而已,理论上可行,但C++标准里是不能实现就不知道了 这么说吧,本意是这样: class B :public A { int Add(int a, int b) { return A:Add(a, b); } } 希望派生类的方法其实是调用基类的方法,不需要显示的调用,编译器或链接器直接解决,因为类方法的原理只是在类定义结构里填写函数指针的问题 |
|
请管理员将帖子删除了吧
本来也没打算访问,只是实现一个类似接口的东东,让别人使用它,忘记基类 |
|
|
|
[讨论]一定要在头文件中申明全局变量或实现函数,而且要保持唯一性,应该怎么办?
知道了,全部实现为class的static成员函数,就不会生成多份了 |
|
|
|
[讨论]一定要在头文件中申明全局变量或实现函数,而且要保持唯一性,应该怎么办?
我刚查了下这种用法,真心就是我想要的啊 谢谢了 对了,好像不用这么复杂,直接这样就行: __declspec(selectany) DWORD g_dwXXX = -1; 是不是啊,不需要放到类里再static,反正我是编译且链接过了,没冲突 对了,变量名有解了 函数是不是无解?它会生成多份实例 |
|
[讨论]一定要在头文件中申明全局变量或实现函数,而且要保持唯一性,应该怎么办?
我主功能用到了类,但类里有些数据实现成全局变量,以优化性能 如有些东西经过很复杂的很耗时的过程得来的,再次实例化对象时,可直接重用,而不需要再做一次,大概就是这个意思: |
|
|
|
|
|
[讨论]一定要在头文件中申明全局变量或实现函数,而且要保持唯一性,应该怎么办?
是啊 所以现在就是看有没有办法不冲突 #ifndef是解决不了的,因为冲突可能是链接冲突而不是编译冲突,全局变量被多实例化时,#ifndef没用 如果实在搞不定,只能h+cpp了 现在是在找方法 |
|
[讨论]一定要在头文件中申明全局变量或实现函数,而且要保持唯一性,应该怎么办?
你没有全局变量哦,你这个应该是模板吧 |
|
[讨论]一定要在头文件中申明全局变量或实现函数,而且要保持唯一性,应该怎么办?
嗯,其实要解很容易的,只要在变量和函数前加个关键字,表示这个是唯一的就行了,应该不是ms不想解吧,只是可能不是很必要吧 头文件的好处是别人使用起来方便,就像我们用std库一样,从来都是include,也不管它在哪,也不用添加cpp,使用者简单, 当然,我里面其实很复杂,做了很多事,但暴露给外面的,就很简单了 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值