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

Difference between a copy constructor and an assignment operator.

953


What are the uses of pointers?

1029


What is helper in c++?

1047


How does code-bloating occur in c++?

1146


How do you find out if a linked-list has an end? (I.e. The list is not a cycle)

1123


What is implicit pointer in c++?

1047


Can non-public members of another instance of the class be retrieved by the method of the same class?

1047


What is the use of object in c++?

1067


What is array give example?

1001


What is encapsulation in c++?

1224


How do I write a c++ program?

1064


What is the difference between the indirection operator and the address of oper-ator?

1069


Is swift faster than c++?

976


What are exceptions c++?

997


Can you please explain the difference between using macro and inline functions?

1014