What is the difference between Class and Structure?

Answer Posted / nikhil jain

Structures are value types; classes are reference types.
Structures use stack allocation; classes use heap
allocation.

A structure must have at least one nonshared variable or
event member; a
class can be completely empty.

Is This Answer Correct ?    4 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is copy constructor? Can we make copy constructor private in c++?

597


What do you understand by a pure virtual member function?

547


Define Virtual function in C++.

621


What is a map in c++?

580


What is std :: endl?

596






What are references in c++?

654


What is c++ array?

547


what is upcasting in C++?

718


What does it mean to declare a member function as virtual?

583


What is stl containers in c++?

585


What is buffer and example?

523


What is the header file for setw?

573


What does floor mean in c++?

578


Difference between overloading vs. Overriding

588


What is abstraction c++?

587