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
How do you declare a set in c++?
Is oops and c++ same?
give me an example for testing a program showing the test path .show how the test is important and complex.
What is the difference between equal to (==) and assignment operator (=)?
What do you mean by public protected and private in c++?
What is a virtual destructor? Explain the use of it?
What is the last index number in an array of 100 characters a) 100 b) 99 c) 101
Is nan a c++?
What is the difference between C and CPP?
Implement stack operations with pointers with appropriate exception checks.
what are the characteristics of Class Members in C++?
How can you link a c++ program to c functions?
Which is the best c++ software?
What is object in c++ example?
Is c or c++ more useful?