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 problem does the namespace feature solve?

1 Answers  


What are iterators in c++?

0 Answers  


Which should be more useful: the protected and public virtuals?

0 Answers  


Describe Trees using C++ with an example.

0 Answers  


what is data encapsulation in C++?

0 Answers  






What are the rules about using an underscore in a c++ identifier?

0 Answers  


Is the declaration of a class its interface or its implementation?

0 Answers  


What is flush programming?

0 Answers  


What is c++ course?

0 Answers  


What are static type checking?

0 Answers  


What is endianness?

0 Answers  


How many types of modularization are there in c++?

0 Answers  


Categories