Is structure can be inherited?

Answers were Sorted based on User's Feedback



Is structure can be inherited?..

Answer / vinay bondade

Everything for what a class is implemented holds good for
structure also in C++. The only difference is the
attributes in a class if access specifiers are not
specified they are Private members but for structure they
are public members.

Is This Answer Correct ?    24 Yes 1 No

Is structure can be inherited?..

Answer / priya

yes it can be in C++:

#include <iostream>
using namespace std;


struct person
{
private:
char name[20];
int age;
public:
float calsalary();
};
struct emp:public person
{
int empid;
private:
float salary;
float bonus;

};

Is This Answer Correct ?    17 Yes 2 No

Is structure can be inherited?..

Answer / sabu

Everything for what a class is implemented holds good for
structure also in C++.

Is This Answer Correct ?    8 Yes 4 No

Is structure can be inherited?..

Answer / chethu

Then what for the class is introduced in C++.. they could
have continued using the structure with OOPS concept only rite?

Is This Answer Correct ?    1 Yes 0 No

Is structure can be inherited?..

Answer / mahan

struct has come into c++ from C. It enables to group together different elements of different types so that we can access them together. Basically it simplifies memory access. All members in a struct have their access as public.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C++ General Interview Questions

Who calls main function?

0 Answers  


Explain the difference between realloc() and free() in c++?

0 Answers  


How to avoid a class from instantiation?

8 Answers   Symphony,


Should I learn c++ c?

0 Answers  


What do you know about friend class and friend function?

1 Answers  






How to write a program such that it will delete itself after exectution?

3 Answers  


write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;

0 Answers  


What are c++ templates used for?

0 Answers  


why c++ is not called strictly d super set of c?

3 Answers   Satyam,


To what does “event-driven” refer?

0 Answers  


Name four predefined macros.

0 Answers  


What is tellg () in c++?

0 Answers  


Categories