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
You have two pairs: new() and delete() and another pair : alloc() and free(). Explain differences between eg. New() and malloc()
What is a block in c++?
Why c++ is not a pure oop language?
Explain the use of this pointer?
Do you know about latest advancements in C++ ?
Differentiate between an inspector and a mutator ?
Explain dangling pointer.
What is purpose of new operator?
write a corrected statement in c++ so that the statement will work properly. x = y = z + 3a;
Explain the difference between abstract class and interface in c++?
Is java as fast as c++?
Does c++ cost money?
Assume an array of structure is in order by studentID field of the record, where student IDs go from 101 to 500. Write the most efficient pseudocode algorithm you can to find the record with a specific studentID if every single student ID from 101 to 500 is used and the array has 400 elements. Write the most efficient pseudocode algorithm you can to find a record with a studentID near the end of the IDs, say in the range from 450 to 500, if not every single student ID in the range of 101 to 500 is used and the array size is only 300
What is the difference between ++ count and count ++?
What is function declaration in c++ with example?