0

Possible Duplicate:
What are the differences between struct and class in C++

consider that i need to answer this question for interview..

Community
  • 1
  • 1
Trupti
  • 597
  • 4
  • 8
  • 17
  • This is a duplicate of http://stackoverflow.com/questions/92859/what-are-the-differences-between-struct-and-class-in-c – rubenvb Dec 19 '10 at 15:14
  • Pasting that subject into the search box should have given you the result commented on by @rubenvb. – Linus Kleen Dec 19 '10 at 15:16

2 Answers2

2

in structure, the member access specifier are default to public while on class is private.

uray
  • 11,254
  • 13
  • 54
  • 74
1

This is a standard interview question.

The standard (and correct) answer is "A struct's members are public by default while a class' members are private by default."

For bonus points, the full answer is "A struct's members are public by default and inheritance is public by default whereas a class's members and inheritance are private by default."

bryceman
  • 11
  • 2