What is the difference between struct and class?



What is the difference between struct and class?..

Answer / hrpynux@gmail.com

Structs are value type whereas Classes are reference type. Structs are stored on the stack whereas Classes are stored on the heap. Value types hold their value in memory where they are declared, but reference type holds a reference to an object memory.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

what is static function

2 Answers   Patni,


How long it will take to learn c++?

0 Answers  


What is the use of typedef?

0 Answers  


What is a "Copy Constructor"?

2 Answers  


What does '\r' and '\b' mean? Please explain with example.

7 Answers  






how to create window program in c++.please explain.

1 Answers   Microsoft,


Define macro.

0 Answers  


What is the difference in size of this two clasees? Class A { int a; char c; float f; } Class B { float f; char c; int a; }

4 Answers  


Difference between struct and class in terms of access modifier.

0 Answers  


Problem 5: Hero's Formula is A method for calculating the area of a triangle when you know the lengths of all three sides. Let a, b, c be the lengths of the sides of a triangle. The area is given by:A= pp-ap-b(p-c) | wherep= a+b+c2 | | Write a C-language code to calculate area of triangle using above method. Take the three lengths of the triangle from the user and display the area that your program calculates.

0 Answers   Maxobiz,


What happens if an exception is throws from an, object's constructor and object's destructor?

4 Answers   Wipro,


What are the important differences between c++ and java?

0 Answers  


Categories