Preface
I wondered, what if a class, for example A
, has two methods, one that can only be call when A
is not a instance, but the other one can only be call when A
is an instance.
Pseudo Code
|
|
I looked up for a while on the Internet, and I found there is actually a thing called Static Member.
What is a static member
- There is only one copy of that member.
- It is initialized when the program start, even before main starts.
- It stands for the entire program life.
For example
|
|
But if I do
|
|
This is pretty handy when I need to use something that doesn’t belong to the instance.
However, it does belong to the class.
Like
|
|
ActiveWindow is not a part of current window; nevertheless, rect is.
Very interesting. :D