What is difference between class and structure?



What is difference between class and structure?..

Answer / Sangram Singh

"In C, structures are user-defined data types that group variables together. They do not have methods or inheritance. Classes in C++ are similar to structures but they also include functions (methods) and can have constructors and destructors. Classes can have inheritance and polymorphism features.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

What is a program flowchart and explain how does it help in writing a program?

1 Answers  


What do you mean by recursion in c?

1 Answers  


What is Your Name :)

1 Answers  


Which of the Following will define a type NODE that is a node in a Linked list? A)struct node {NODE*next;int x;};type def struct node NODE; B)typedef struct NODE {struct NODE *next;int x;}; C)typedef struct NODE {NODE *next;int x;}; D)typedef struct {NODE *next;int x;}NODE;

5 Answers   Accenture, TCS,


x=2,y=6,z=6 x=y==z; printf(%d",x)

13 Answers   Bharat, Cisco, HCL, TCS,


What is structure padding ?

3 Answers   HP,


What is the value of uninitialized variable in c?

1 Answers  


How many types of arrays are there in c?

1 Answers  


what are bit fields? What is the use of bit fields in a structure declaration?

1 Answers   Flextronics, TISL, Virtusa,


What functions are used in dynamic memory allocation in c?

1 Answers  


What is the difference between void main() and void main (void) give example programme?

0 Answers  


m=++i&&++j(||)k++ printf("%d"i,j,k,m)

1 Answers   ABC,


Categories