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 is lambda expression c++?

574


Can constructor be private in c++?

604


Write a program which uses functions like strcmp(), strcpy()? etc

609


If I is an integer variable, which is faster ++i or i++?

586


Which is the best c++ compiler?

583






What is a wchar_t in c++?

579


Is python better than c++?

582


What is the fastest c++ compiler?

580


Where Malloc(), Calloc(), and realloc() does get memory?

605


Is c++ a pure oop language?

592


Name the debugging methods that are used to solve problems?

576


What is a Default constructor?

911


What is a dangling pointer in c++?

652


Should I learn c or c++ or c#?

551


If all is successful, what should main return a) 0 b) 1 c) void

554