Difference between Class and Struct.
Answer Posted / jammu hari cell:9848278041
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.
| Is This Answer Correct ? | 20 Yes | 8 No |
Post New Answer View All Answers
hi send me sample aptitude papers of cts?
How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?
How can you increase the allowable number of simultaneously open files?
I need testPalindrome and removeSpace
#include
What are the valid places to have keyword “break”?
what do you mean by enumeration constant?
application attempts to perform an operation?
Is javascript written in c?
what do the 'c' and 'v' in argc and argv stand for?
What is the use of pointers in C?
What is clrscr ()?
What is array of structure in c programming?
int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above
What is string concatenation in c?
What is the use of define in c?