Q : Stack and heap memory A : Stack: Allocated on - TopicsExpress



          

Q : Stack and heap memory A : Stack: Allocated on function call and automatically freed on function exit. This process is called stack unwinding. Heap: gets allocated explicitly by the programmer and is there until the programmer explicitly frees it or until the process exits. Nothing happens automatically. Life time and size is controllable. Q : Static variables & Functions A : The static variables are allocated on data section of the process address space. So a static member variable can be used for counting the number of the objects as the lifetime of the variable is the lifetime of the process, but scope of the variable is not the entire file. The static functions can access only the static variables. Apart from that , the static functions can access the constructor also no matter the constructor is public or private in the class. This concept we use for creation of singleton class. A static function can’t access the this pointer. That’s why it can be called without any object. But it can be called with an object as well.
Posted on: Fri, 19 Sep 2014 04:30:01 +0000

Trending Topics



of art that we enter, we stay to ponder and
e clar, nu sunt singurul nebun care s a gândit la asta: V-aţi
I have never heard so much excrement come from the hearing with
A Conversation You need to Have with Yourself: What you love.
Now to go back and clean up the rest of the deer strike that some

Recently Viewed Topics




© 2015