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 are the differences between a struct and a class in
C++?

Answer Posted / shivani

In Class Members are private by default.
In Structure Member are public by default.
structures are value typed where as classes are refernce
typed

Class can be inherited But Structure can't be inherited

In structures we cannot initilase the variable during the
declaration while in classes we can.

Structure s does not support polymorphism while class does

Structure can be declared without a tag at the first time,
but not in case of class.

e.g. struct { variables; }(struct variable list); [It would
not raise any error while comlitation]

class { access specifier: variable list; access specifier:
vari....

}; [it will cause an error while compilation]

Is This Answer Correct ?    3 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain 'this' pointer and what would happen if a pointer is deleted twice?

1077


Which coding certification is best?

1031


What is the difference between passing by reference and passing a reference?

1082


Is it possible to use a new for the reallocation of pointers ?

1065


Explain what are accessor methods?

1125


If a base class declares a function to be virtual, and a derived class does not use the term virtual when overriding that class, is it still virtual when inherited by a third-generation class?

1035


What is basic if statement syntax?

1091


Can we delete this pointer in c++?

1222


Is c++ the hardest language?

990


How much do coding jobs pay?

1013


When can I use a forward declaration?

1104


Can circle be called an ellipse?

1081


Differentiate between a template class and class template in c++?

1101


What is class and structure in c++?

1181


How java is different from c and c++?

1202