What is the difference b/w Structure & Class?

Answers were Sorted based on User's Feedback



What is the difference b/w Structure & Class?..

Answer / srilatha

1.structure contains only data members.
class contains data members and member functions.

2.in structures we can use keyword struct.
in classes we can use keyword class.

Is This Answer Correct ?    5 Yes 3 No

What is the difference b/w Structure & Class?..

Answer / mohan chaudhari

1.In structure there is no data encapsulation.
but in class, there is data encapsulation.
2.Data member in structure are not private .
In class they are private.

Is This Answer Correct ?    2 Yes 1 No

What is the difference b/w Structure & Class?..

Answer / alekhya

1.in structure we have only data members where as
in class we have members and member functions
2.in class we declare members with access specifiers like
private,public...
in structs we dont have any access specifiers all the
members of structure are pubic

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C Interview Questions

Which is better between malloc and calloc?

0 Answers  


Using which language Test cases are added in .ptu file of RTRT unit testing???

0 Answers  


write a program which counts a product of array elements lower than 10.

1 Answers  


What is switch in c?

0 Answers  


Can I initialize unions?

0 Answers  






What is the g value paradox?

0 Answers  


how can i calculate mean,median,mode by using c program

1 Answers   HCL,


write a function which accept two numbers from main() and interchange them using pointers?

3 Answers  


What is a Genralised LInked List?? Please give a detailed explation of it..

1 Answers  


char *p="name"; printf(p);

1 Answers  


what is difference between declaring the pointer as int and char in c language?

3 Answers  


Why is c known as a mother language?

0 Answers  


Categories