What is the difference between Class and Structure?
Answer Posted / p govind rao
1) structure :- In structure have a by default public.
In class have a by default private.
2) Structure cannot be inherited. But class can be
inherit.
3) There is no data hiding features comes with
structures. Classes do, private, protected and public.
4) A structure can't be abstract, a class can.
5) A structure is a value type, while a class is a
reference type.
6) A structure is contain only data member , but class
contain data member and member function.
7) In a Structure we can't initilse the value to the
variable but in class variable we assign the values.
8) Structure are value type, They are stored as a
stack on memory. where as class are reference type. They
are stored as heap on memory.
Is This Answer Correct ? | 597 Yes | 96 No |
Post New Answer View All Answers
What do you mean by static variables?
What are the 3 levels of programming languages?
How do I download c++?
Does dev c++ support c++ 11?
Who was the creator of c++?
What are the extraction and insertion operators in c++? Explain with examples.
What is meant by the term name mangling in c++?
What are the differences between java and c++?
What is the use of object in c++?
Write some differences between an external iterator and an internal iterator?
What are the stages in the development cycle?
What is c++ in english?
what does the following statement mean? int (*a)[4]
What are c++ variables?
Differentiate between the manipulator and setf( ) function?