由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - [c++] static function in a class
相关主题
another c++ interview questionHow to make sure that I get the original object or only a copy (not original) in such situation?
Global(static) variable initialization questionC++做题,麻烦师傅们再看看。
[合集] 为什么很少有人用static来实现signleton?请教goodbug等大神几个AWS的问题
c++ singleton questions请教高手一个C++问题
弱问:C#定义的class里面直接new出来的成员存在了哪里?What is "number of bits set"?
问一个java基础的初始化的问题,一直搞不明白java小问题
ThreadLocal可以这样用吗?how to initialize this struct.
[合集] C++ private member questionwindows 下怎么让同一个程序的不同instance之间通信呢
相关话题的讨论汇总
话题: static话题: function话题: class话题: c++话题: 明为
进入Programming版参与讨论
1 (共1页)
G****A
发帖数: 4160
1
即使不声明为static,无论建立多少个instances,class function始终只keep一个copy。
既然这样,请问为什么只有被声明为static function 才能 be called without an
instance of the class.
h*******s
发帖数: 8454
2
不是static的函数调用的时候系统自己给牵头加上一个this指针作为第一个参数
如果没有instance,哪儿来得this指针啦
不是static的函数可以修改instance自己的私有变量啊,虽然只有一个,但是从哪里调
用还是有区别的

copy。

【在 G****A 的大作中提到】
: 即使不声明为static,无论建立多少个instances,class function始终只keep一个copy。
: 既然这样,请问为什么只有被声明为static function 才能 be called without an
: instance of the class.

b********n
发帖数: 609
3
你这简直连入门都谈不上啊。

copy。

【在 G****A 的大作中提到】
: 即使不声明为static,无论建立多少个instances,class function始终只keep一个copy。
: 既然这样,请问为什么只有被声明为static function 才能 be called without an
: instance of the class.

G****A
发帖数: 4160
4
是啊,coding水平比本科时候还差。只有恶补了

【在 b********n 的大作中提到】
: 你这简直连入门都谈不上啊。
:
: copy。

y****e
发帖数: 23939
5
能这样去思考问题,已经很不错了。继续努力!

【在 G****A 的大作中提到】
: 是啊,coding水平比本科时候还差。只有恶补了
1 (共1页)
进入Programming版参与讨论
相关主题
windows 下怎么让同一个程序的不同instance之间通信呢弱问:C#定义的class里面直接new出来的成员存在了哪里?
how to create an instance of base class in its derived class definition问一个java基础的初始化的问题,一直搞不明白
谁熟dotnet 的webservice?ThreadLocal可以这样用吗?
请教C++面试题[合集] C++ private member question
another c++ interview questionHow to make sure that I get the original object or only a copy (not original) in such situation?
Global(static) variable initialization questionC++做题,麻烦师傅们再看看。
[合集] 为什么很少有人用static来实现signleton?请教goodbug等大神几个AWS的问题
c++ singleton questions请教高手一个C++问题
相关话题的讨论汇总
话题: static话题: function话题: class话题: c++话题: 明为