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
If i have an array 0 to 99 i.e,(Size 100) I place the values 1 to 100 randomly like a[0]=29,a[1]=56 upto array[99].. the values are only between 1 to 100. getting the array values by using scanf.. If i entered one wrong element value line a[56]=108. how can i find it.. and also how to find the missing value in 1 to 100.. and i want to replace the missing values.. any one of them know please post your answer..
What language is windows 1.0 written?
How do you define a function?
write a c program for swapping two strings using pointer
What are the Advantages of using macro
What is difference between && and & in c?
regarding pointers concept
Write a program to swap two numbers without using a temporary variable?
What are two dimensional arrays alternatively called as?
What is the purpose of main() function?
What’s the special use of UNIONS?
I came across some code that puts a (void) cast before each call to printf. Why?
Can you apply link and association interchangeably?
How can I send mail from within a c program?
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?