为什么一个类的静态成员对于所有对象都是相同的? [英] Why are the static members of a class the same for all objects?
本文介绍了为什么一个类的静态成员对于所有对象都是相同的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么我们不同的对象有不同的静态变量副本?
Why don't we have different copies of static variables for the different objects?
推荐答案
href =http://en.wikipedia.org/wiki/Instance_variable =nofollow>实例成员。
Because they would be instance members then.
静态成员是指该类的所有实例共享。
The primary characteristic of static members is that they're shared by all the instances of the class.
这篇关于为什么一个类的静态成员对于所有对象都是相同的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文