where is memory for struct allocated?
where is memory for class-object allocated?
I replied for struct in stack and for class-object in heap.
THen he asked if class has struct member variable what
happens.class on heap and what about struct in that class?
couldnt ans :( :-?
Answer Posted / vishwa
Both are allocated in heap.
Also if any structure is declared in a function, the
function stack creates a heap from the stack. so these
structures in function allocates in heap.
Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
Which is better struts or spring?
What is oops and why we use oops?
What is encapsulation example?
Why we use classes in oop?
What is destructor give example?
Which language is pure oop?
What is property in oops?
What language is oop?
class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash
What is data binding in oops?
officer say me - i am offered to a smoking , then what can you say
What is difference between abstraction and encapsulation?
Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)
Templates mean
What is destructor example?