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

Explain selection sorting. Also write an example.

590


What is the type of this pointer in c++?

640


Which sort does c++ use?

584


Explain stack & heap objects?

640


What are references in c++? What is a local reference?

578






What is a sequence in c++?

590


Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?

572


What is the oldest programming language?

583


How do you clear a set in c++?

611


Explain how functions are classified in C++ ?

815


What are the effects after calling the delete this operator ?

565


Which is the best c++ compiler for beginners?

570


What does ios :: app do in c++?

558


What is implicit conversion/coercion in c++?

659


Out of fgets() and gets() which function is safe to use?

647