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
What are the various operations performed on stack?
Is c++ platform dependent?
What is meant by const_cast?
Will this c++ program execute or not?
What are guid?
What is the function to call to turn an ascii string into a long?
What is the hardest coding language to learn?
what kind of projects are suitable for c and c++
Write my own zero-argument manipulator that should work same as hex?
Are c and c++ different?
What is #include c++?
Is C++ case sensitive a) False b) Depends on implementation c) True
Does c++ have a hash table?
What information can an exception contain?
What are the storage qualifiers?