Difference between Structure and Class in C++?

Answers were Sorted based on User's Feedback



Difference between Structure and Class in C++?..

Answer / ashish raghuvanshi

Basically in C++ structure and class are same but with some
minor diffrences listed below:-
1. In classes all the members by default are private but in
structure members are public by default.
2. There is no term like constructor and destructor for
structs, but for class compiler creates default if you
don't provide.

Is This Answer Correct ?    79 Yes 14 No

Difference between Structure and Class in C++?..

Answer / madhusudhan

1. In classes all the members by default are private but in
structure members are public by default.

2. There is no term like constructor and destructor for
structs, but for class compiler creates default if you
don't provide.

3. Sizeof empty structure is 0 Bytes wer as Sizeof empty
class is 1 Byte

Is This Answer Correct ?    24 Yes 20 No

Difference between Structure and Class in C++?..

Answer / ammukutty

give the clear full difference between structure and class

Is This Answer Correct ?    2 Yes 1 No

Difference between Structure and Class in C++?..

Answer / alok

no. we can use the concept of constructor and destruct in c++ structure. one difference is that in c structure and c++ class is structure automatically initialization with zero.

Is This Answer Correct ?    2 Yes 8 No

Difference between Structure and Class in C++?..

Answer / poooooooo

sexy and funny

Is This Answer Correct ?    13 Yes 58 No

Post New Answer

More STL Interview Questions

What is the STL?

2 Answers   Epson, HP,


In what scenario does the Logical file and Physical file being used?

0 Answers   informatics,


I am doing my BS.c MATHS CAN I ABLE TO JOIN IN NIIT?

2 Answers  


what is the acronym of the term 'C.O.M.P.U.T.E.R' ?

17 Answers   Config Systems, Google, Wipro,


what is an algorithm in terms of STL?

1 Answers   Lucent, Wipro,






WHAT IS FIBONACCI SERIES?

4 Answers   Stewart,


What is stl in c++ with example?

0 Answers  


What is 2*2?

7 Answers  


What is stl in oop?

0 Answers  


differentiate between private, public and protected data members of the class using example.

1 Answers  


Give the output of the following program main() {int ret; ret=fork();ret=fork();ret=fork();ret=fork(); if(!ret) printf("sun"); else printf("solaris");

8 Answers   Sun Microsystems,


what is the difference between thread and process

1 Answers   Infosys,


Categories