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
What do you mean by a sequential access file?
Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
What is the difference between void main and main in c?
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
largest Of three Number using without if condition?
What does %p mean c?
How do you search data in a data file using random access method?
Explain how can I right-justify a string?
What is the meaning of typedef struct in c?
Is fortran still used today?
Hi can anyone tell what is a start up code?
What is the heap in c?
Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff
What is unary operator?
When should the volatile modifier be used?