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 / rajanikanth
variable: value type lives on the stack, reference type lives on the stack as a pointer to somewhere in heap memory where the actual memory lives
class/struct-field: value type lives inside the class, reference type lives inside the class as a pointer to somewhere in heap memory where the actual memory lives.
Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
What is overloading in oop?
How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction
Why do we need polymorphism in c#?
what type of questions
What are the data types in oop?
Why multiple inheritance is not allowed?
How do you achieve polymorphism?
Can a destructor be called directly?
• What are the desirable attributes for memory managment?
How oops is better than procedural?
hi, this is raju,iam studying b.tech 2nd year,iam want know about group1 and group2 details, and we can studying without going to any instutions? please help me.
what's the basic's in dot net
What is inheritance in oop?
2. Give the different notations for the class.\
What is stream in oop?