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

Write a program in C/C++ to implement reader- writer problem

1 Answers   Wipro,


wap in c++ which accept a integer array and its size as argument and replaces element having even values with its half and element having odd values with twice its value

1 Answers  


Waht is inheritance

6 Answers  


Which data structure gives efficient search? A. B-tree B. binary tree C. array D. linked list

21 Answers   ABC, Sun Microsystems,


What is a standard template library (stl)? What are the various types of stl containers?

0 Answers  


what are you now programming Languages C+

1 Answers   HCL,


What do you mean by stl?

1 Answers  


please visit this site you'll find my question this is my homework please answer it if you can http://easyscience.org/ib/lofiversion/index.php/t36168.html

0 Answers  


How is stl different from c++ standard library?

0 Answers  


what is template and type convertion

0 Answers   TATA,


Describe how to safeguard a system through acquisition of an antivirus Program and systematic backup.

0 Answers  


What is a list in c++ stl?

0 Answers  


Categories