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...

Difference between Class and Struct.

Answer Posted / jammu hari (v.v. narasimharao

Difference between class & Structure is :-
-------------------------------------------

1. class = data + functions
structure=Collection of different data
2. Class supports Re-usability. Structures are used to handle
the complex data.
3. Both are user defined data types.
4. 'struct' is a keyword which is used to declare a structure.
'class' is a keyword used to declare a class.
5. By default all the structure members are public. But in
class all the members are private.
6. Structure variable is used to access the structure
members. Object is used to access the class members.
7. Structure is less secure than the class.
8. Structure is a procedure Oriented feature. Object is a
Object Oriented Feature.
9. Both Structure & Class uses (.) dot operator to access
their members.
10. class contains 3 access specifiers But structure has
only 1 access specifier.
11. We can inherit a class. But we can't inherit structure.
12. We can declare constructors & destructors inside of a
class. But we can't declare these in Structure.
13. Structure are not suitable of Data Hiding. But classes
well suited for data hiding.
14. Structure is a valute type. Class is a reference type.
so, class data is stored in heap & structure data is
stored in stack.
15. class is an extension to the structure.
16. structures are used to handle the complex data.
class is used for reusability.

Is This Answer Correct ?    41 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

ATM machine and railway reservation class/object diagram

5191


How can I sort more data than will fit in memory?

1038


Which header file is used for clrscr?

997


What are file streams?

960


Is it better to use a macro or a function?

1097


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

1140


Explain how are 16- and 32-bit numbers stored?

1206


What is use of pointer?

1006


What is the easiest sorting method to use?

1096


Can the “if” function be used in comparing strings?

976


What is c language used for?

921


What is structure in c explain with example?

1089


What are derived data types in c?

1007


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

3912


Implement bit Array in C.

1094