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

Why is c fast?

0 Answers  


Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given

0 Answers   XYZ,


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

0 Answers   TCS,


Who invented bcpl language?

0 Answers  


Write a program in C for showing working of different logical operator in C. Your program should guide users with proper message/menu on the console.

3 Answers   HCL,






How to implement call back functions ?

3 Answers   HP,


write a program to search for an element in a given array. If the array was found then display its position otherwise display appropriate message in c language

18 Answers   IT Park, TCS,


What is key word in c language?

4 Answers   ABC,


what is the return value (status code) of exit() function.... what the arguments(integer value) passed to it means....

1 Answers   TCS,


i want to job in your company, so how it will be possible.

3 Answers   TCS,


What does static mean in c?

1 Answers  


15.what is the disadvantage of using macros? 16.what is the self-referential structure? 17.can a union be self-referenced? 18.What is a pointer? 19.What is the Lvalue and Rvalue? 20.what is the difference between these initializations? 21.Char a[]=”string”; 22.Char *p=”literal”; 23.Does *p++ increment p, or what it points to?

2 Answers   CTS,


Categories