What are the differences between a struct and a class in
C++?

Answer Posted / rsn

Hello Shivani,

I think both struct and class in C++ are quite the same
except for the fact that, members in struct are public by
default whereas they are private for class.
Moreover struct also supports inheritance,polymorphism
etc...etc...

Is This Answer Correct ?    14 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a Program for dynamically intialize a 2 dimentional array. Eg:5x20, accept strings and check for vowels and display the no.finally free the space allocated .

673


If all is successful, what should main return a) 0 b) 1 c) void

552


Explain selection sorting?

632


Does c++ have finally?

561


Is java a c++?

552






What are the uses of typedef in a program?

602


What do you understand by pure virtual function? Write about its use?

573


Can user-defined object be declared as static data member of another class?

544


What is a container class? What are the types of container classes in c++?

672


What is using namespace std in cpp?

539


Can we sort map in c++?

586


What is purpose of abstract class?

578


What is long in c++?

728


what is Loop function? What are different types of Loops?

632


Why c++ is the best language?

586