The two questions in the interview which I took in Microsoft last Friday are shown below:
1. How a static variable can be accessed (in different scopes)?
2. How the compilers realize the virtual functions? (not in run time)
My ans:
1. The keyword static means let the variable be global stored variable, and where even you change it. All the references (or in other places) of it were changed. But the static don't change the access rule. So, if you declare it in local, you can only use it locally. If you declare it in a file, you can only use it in the scope of this file. If you declare it in a class, you can use it with the namespace of the class name.
I havn't clear idea about them. I 'll make clear of them later...
No comments:
Post a Comment