What Are The Differences Between A C++ Struct And C++ Class?
Answer Posted / shalesh kumar
The default member and base-class access specifies are different.
This is one of the commonly misunderstood aspects of C++. Believe it or not, many programmers think that a C++ struct is just like a C struct, while a C++ class has inheritance, access specifies, member functions, overloaded operators, and so on. Actually, the C++ struct has all the features of the class. The only differences are that a struct defaults to public member access and public base-class inheritance, and a class defaults to the private access specified and private base-class inheritance.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is meant by the term name mangling in c++?
Can a new be used in place of old mallocq? If yes, why?
In a function declaration what does extern means?
Is dev c++ free?
What will happen if a pointer is deleted twice?
Can a destructor be called directly?
Difference between a copy constructor and an assignment operator.
what type of question are asked in thoughtworks pair programming round ?
Why do we use templates?
What exactly is polymorphism?
What is a sequence in c++?
What is the use of 'using' declaration in c++?
What is static class data?
What is the difference between multiple and multilevel inheritance in c++?
What is the use of endl in c++ give an example?