What is the difference between Class and Structure?

Answer Posted / anshu sharma

Structure are value types and classes are reference types.So
structures use stack and classes use heap.
Structures members can not be declared as protected , but
class members can be.
You can not do inheritance in structures.
Structures do not require constructors while classes require

Is This Answer Correct ?    158 Yes 54 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are virtual constructors/destructors?

567


Can there be at least some solution to determine the number of arguments passed to a variable argument list function?

593


What is the difference between a declaration and a definition?

573


Why c++ is the best language?

582


describe private access specifiers?

626






Can you please explain the difference between using macro and inline functions?

515


Why do we need runtime polymorphism in c++?

551


When you overload member functions, in what ways must they differ?

577


What is the difference between ++ count and count ++?

569


Can we declare a base-class destructor as virtual?

577


What is a c++ map?

648


How do you add an element to a set in c++?

541


Does c++ support multilevel and multiple inheritances?

537


How many static variables are created if you put one static member into a template class definition?

554


What is meant by the term name mangling in c++?

509