In which memory a class gets stored(in heap /in stack)?
And why??

Answers were Sorted based on User's Feedback



In which memory a class gets stored(in heap /in stack)? And why??..

Answer / pravin

The stack is a place in the computer memory where all the variables that are declared and initialized before runtime are stored. The heap is the section of computer memory where all the variables created or initialized at runtime are stored.
Hence,classes will be stored in heap memory.

Is This Answer Correct ?    6 Yes 3 No

In which memory a class gets stored(in heap /in stack)? And why??..

Answer / ravi.g

Usually class will get stored when the object/s are created.

Class will get sored in stack segment when the object is
created inside the functions.

When objects are created globally they will get stored in
the data segment.

Is This Answer Correct ?    2 Yes 3 No

Post New Answer

More C++ General Interview Questions

What is a catch statement?

0 Answers  


describe private access specifiers?

0 Answers  


What is a type library?

0 Answers  


What do you mean by abstraction. Explain your answer?

5 Answers  


What is scope of a variable? (LOLZ)

2 Answers   CA, TCS,






What is the sequence of destruction of local objects?

0 Answers  


What should main() return in c and c++?

0 Answers  


Is sorted c++?

0 Answers  


Difference between overloading vs. Overriding

0 Answers  


What is cin clear () in c++?

0 Answers  


What is the latest c++ standard?

0 Answers  


How come you find out if a linked-list is a cycle or not?

0 Answers  


Categories