What are the differences between a struct and a class in
C++?
Answer Posted / shivani
In Class Members are private by default.
In Structure Member are public by default.
structures are value typed where as classes are refernce
typed
Class can be inherited But Structure can't be inherited
In structures we cannot initilase the variable during the
declaration while in classes we can.
Structure s does not support polymorphism while class does
Structure can be declared without a tag at the first time,
but not in case of class.
e.g. struct { variables; }(struct variable list); [It would
not raise any error while comlitation]
class { access specifier: variable list; access specifier:
vari....
}; [it will cause an error while compilation]
Is This Answer Correct ? | 3 Yes | 6 No |
Post New Answer View All Answers
write a programme to get a character and thier ASCII value
What are the differences between new and malloc?
How do you compile the source code with your compiler?
Write a recursive program to calculate factorial in c++.
Is set c++?
We all know that a const variable needs to be initialized at the time of declaration. Then how come the program given below runs properly even when we have not initialized p?
Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?
Why do we use iterators?
What is fflush c++?
What is purpose of new operator?
Why do we learn c++?
Define pre-condition and post-condition to a member function in c++?
What is the oldest programming language?
What is cin clear () in c++?
can any one help to find a specific string between html tags
which is changed to a sting..
weather.html looks (for location) is