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

write a program for odd numbers?

15 Answers  


Explain how do you print an address?

0 Answers  


How can I write a function that takes a format string and a variable number of arguments?

0 Answers  


How can you tell whether a program was compiled using c versus c++?

0 Answers  


What are the different flags in C? And how they are useful? And give example for each in different consequences?

1 Answers  






What are the benefits of organizational structure?

0 Answers  


Write a routine that prints out a 2-D array in spiral order!

1 Answers   Lucent,


Do you know what are the properties of union in c?

0 Answers  


What are external variables in c?

0 Answers  


What is the scope of local variable in c?

0 Answers  


In which mode we open the file for read,write and append also in c ? a)W b)w+ c)r+ d)a

2 Answers   BitWise,


How pointer is benefit for design a data structure algorithm?

2 Answers  


Categories