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
How would you call C functions from C++ and vice versa?
What is the highest level of cohesion?
Differentiate between an array and a list?
Is string an object in c++?
Write a program to encrypt the data in a way that inputs a four digit number and replace each digit by (the sum of that digit plus 7) modulus 10. Then sweep the first digit with the third, second digit with the fourth and print the encrypted number.
How does a C++ structure differ from a C++ class?
Can a function take variable length arguments, if yes, how?
What do you understand by a pure virtual member function?
What are the uses of c++ in the real world?
what are Access specifiers in C++ class? What are the types?
How would you differentiate between a pre and post increment operators while overloading?
What is rtti in c++?
Define 'std'.
Explain what is oop?
Explain the advantages of inheritance.