What is the difference between Class and Structure?

Answer Posted / mohanraj.d

1.structure is a value type.but class is a reference type.
2.structure is stored in stack.but class is stored in heap.
3.struct cannot have default constructor.
4.struct do not support inheritance.
5.class can inherit from a class.
6.struct cannot have declare destructor.
7.class has define object and function.
8.structure has define only object.

Is This Answer Correct ?    50 Yes 28 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is better turbo c++ or dev c++?

551


What are advantages of c++?

550


What doescout<<(0==0) print out a) 0 b) 1 c) Compiler error: Lvalue required

563


Am studying basic c++ programming, have been given the following assignment. Design a linear program to calculate the maximum stress a material can withstand given a force and a diameter of a circle. To find the required area pi should be defined. Have most of the program sorted out but am at a loss as to how to show the calculations required. Can anyone help?

1727


How do you write a function that can reverse a linked-list?

559






How do I get good at c++ programming?

585


What is vector pair in c++?

701


what do you mean by volatile variable?

572


What is the difference between prefix and postfix versions of operator++()?

584


Does c++ support multilevel and multiple inheritances?

537


Which of the following is not a valid declaration for main() a) int main() b) int main(int argc, char *argv[]) c) They both work

595


What is a node class in c++?

636


Is c++ still being used?

553


Explain differences between new() and delete()?

609


What is ios flag in c++?

667