What is the difference between Class and Structure?

Answer Posted / mohanraj.d

1.structure is a value type.but class is a reference type.
2.structure is stored in stack.but class is stored in heap.
3.struct cannot have default constructor.
4.struct do not support inheritance.
5.class can inherit from a class.
6.struct cannot have declare destructor.
7.class has define object and function.
8.structure has define only object.

Is This Answer Correct ?    50 Yes 28 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a set in c++?

521


Which software is best for coding?

560


What do manipulators do?

556


What is a linked list in c++?

534


What is increment operator in c++?

546






What is difference between n and endl in c++?

576


What is static class data?

565


What is c++ w3school?

614


What is constructor in C++?

613


What are keywords in c++?

590


What are friend classes? What are advantages of using friend classes?

590


What is private, public and protected inheritance?

579


What is a block in c++?

536


What is a constant reference?

605


Do the parentheses after the type name make a difference with new?

633