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
What does I oop mean?
What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }
What language is oop?
write a code for this. serial_number contained in the header of the file will be read , if this serial number is less than a previous serial number within a successfully processed file, or is the same as another serial number within a successfully processed file, or if the field contains anything other than 7 digits, then the file must error with the reason ‘Invalid SERIAL_NUMBER’.
What is an interface in oop?
What are the three parts of a simple empty class?
What is balance factor?
What is polymorphism in oops with example?
Why is abstraction needed?
is there any choice in opting subjects like 4 out of 7
What are main features of oop?
What is a class in oop?
what is the drawback of classical methods in oops?
What is a class and object?
What is basic concept of oop?