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

What is static class data?

1069


Which operations are permitted on pointers?

1007


What is the difference between the functions rand(), random(), srand() and randomize()?

1296


What is flush () in c++?

1089


What are the various arithmetic operators in c++?

1136


What is type of 'this' pointer?

1073


What header file is needed for exit(); a) stdlib.h b) conio.h c) dos.h

1059


What is function overloading in C++?

1434


What is the real purpose of class – to export data?

1117


Do you know what are static and dynamic type checking?

1071


How much do c++ programmers make?

1125


How c functions prevents rework and therefore saves the programers time as wel as length of the code ?

1101


What is atoi?

982


If you push the numbers (in order) 1, 3, and 5 onto a stack, which pops out first a) 1 b) 5 c) 3

1378


Can class objects be passed as function arguments?

1077