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
How can you overcome the diamond problem in inheritance?
Write a c++ program to display pass and fail for three student using static member function
What is polymorphism and types?
#include
What is multilevel inheritance in oop?
What is encapsulation with example?
How do you define social class?
What is the difference between abstraction and polymorphism?
program for insertion ,deletion,sorting in double link list
Why do while loop is used?
What are the 3 principles of oop?
What is overriding in oops?
What is new keyword in oops?
i=20;k=0;
for(j=1;k-i;k+=j<10?4:3)
{
cout< Why is encapsulation used?