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
Which c++ operator cannot overload?
What is difference between data abstraction and encapsulation?
Why is c++ still used?
I was a c++ code and was asked to find out the bug in that. The bug was that he declared an object locally in a function and tried to return the pointer to that object. Since the object is local to the function, it no more exists after returning from the function. The pointer, therefore, is invalid outside.
How static variables and local variablesare similar and dissimilar?
Why do we need oop?
Why ctype h is used in c++?
By using c++ with an example describe linked list?
Discuss the role of C++ shorthands.
Write a c++ program to display pass and fail for three student using static member function
What do you mean by function and operator overloading in c++?
What is purpose of abstract class?
explain the term 'resource acquisition is initialization'?
What do you mean by public protected and private in c++?
Explain some examples of operator overloading?