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

find the two largest values among the 6 numbers using control structures : do-while,for,if else,nestedif- else ,while. one or two of them.

2535


What does std mean in c++?

1119


If you hear the cpu fan is running and the monitor power is still on, but you did not see anything show up in the monitor screen. What would you do to find out what is going wrong?

1127


What is the prototype of printf function?

1173


When should I use unitbuf flag?

1008


what is data abstraction in C++?

1071


What do the keywords volatile and mean mutable?

1048


What is the difference between a definition and a declaration?

1059


Explain what are accessor methods?

1119


How would you use qsort() function to sort an array of structures?

1116


Do you know what are the new features that iso/ansi c++ has added to original c++ specifications?

1115


what is C++ objects?

1185


Why c++ is created?

1000


What is the outcome of cout< a) 16 b) 17 c) 16.5

1012


How we can differentiate between a pre and post increment operators during overloading?

1100