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
What is the hardest programming language?
What is difference between structure and union?
The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this
write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list
Tell me when is a void pointer used?
What is a list in c?
What is void c?
can any one provide me the notes of data structure for ignou cs-62 paper
What is structure in c definition?
What are the advantages of union?
What is context in c?
What is extern storage class in c?
Write a code of a general series where the next element is the sum of last k terms.
What is d scanf?
Iam a B.Tech graduate and completed my engineering in 2009, from 2005 to 2009 and after that i had done nothing.Now i want to do job and get into BPO field . Friends give me suggestions as what to say in interview... if they ask me that what would you had done ... these many years without doing job ??????? pls urgent