Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the difference between Class and Structure?

Answer Posted / sanjay yadav

# 5
Structs are Value type. They are stored as a stack on
memory.
Class is reference type. They are stored as heap on memory.
Sturcts constructor must contain a parameter and cannot
have default constructor.
Class constructor may contain no parameter.
Struct cannot have instance field.
Class can have instance field.
Struct cannot inherit from a structure.
Class can inherit from a class.
Structs cannot declare a destructor.

structure :- In structure have a by default public.
In class have a by default private.
Structure cannot be inherited. But class can be
inherit.
There is no data hiding features comes with
structures. Classes do, private, protected and public.
A structure can't be abstract, a class can.
A structure is a value type, while a class is a
reference type.
A structure is contain only data member , but class
contain data member and member function.
In a Structure we can't initilse the value to the
variable but in class variable we assign the values.
Structure are value type, They are stored as a
stack on memory. where as class are reference type. They
are stored as heap on memory.

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we need constructors in c++?

1056


What is exception handling? Does c++ support exception handling?

972


What function initalizes variables in a class: a) Destructor b) Constitutor c) Constructor

1099


What is scope operator in c++?

1031


What's the order in which the local objects are destructed?

1197


Why do we use double in c++?

1003


Which bitwise operator is used to check whether a particular bit is on or off?

1006


What are smart pointers?

2159


Which software is used to run c++ program?

940


Write about an iterator class?

1025


What is object file? How can you access object file?

1117


State the difference between delete and delete[].

1031


Why #include is used?

1002


What is a class definition?

1007


What is operator overloading in c++ example?

1045