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

A program to allow an input operand and operator from the operator and read on the display and output operand.

0 Answers  


What is the difference between text and binary i/o?

0 Answers  


What are valid signatures for the Main function?

0 Answers  


What is use of null pointer in c?

0 Answers  


Explain how do you search data in a data file using random access method?

0 Answers  






What is true about the following C Functions a.Need not return any value b.Should always return an integer c.Should always return a float d.Should always return more than one value.

11 Answers   TCS,


Write a code to reverse string seperated by spaces i/p str=India is my country o/p str=aidnI si ym yrtnuoc After writing code, optimize the code

1 Answers  


What's the difference between a linked list and an array?

14 Answers  


What are conditional operators in C?

0 Answers   Adobe,


c program to manipulate x=1!+2!+3!+...+n! using recursion

1 Answers   TCS,


Is it valid to address one element beyond the end of an array?

0 Answers  


How variables are declared in c?

0 Answers  


Categories