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

Explain how an exception handler is defined and invoked in a Program.

0 Answers  


Can char be a number c++?

0 Answers  


What is the benefit of learning c++?

0 Answers  


What is the difference between #import and #include?

0 Answers  


What are pointer-to-members in C++? Give their syntax.

0 Answers   HAL,






What is namespace std; and what is consists of?

0 Answers  


Profiler in projects?

2 Answers   Symphony,


Snake Game: This is normal snake game which you can find in most of the mobiles. You can develop it in Java, C/C++, C# or what ever language you know.

0 Answers  


What do you mean by pure virtual functions in C++? Give an example?

1 Answers  


what is a reference variable in C++?

0 Answers  


what is the use of void main() in C++ language?

0 Answers  


How do you show the declaration of a virtual constructor?

0 Answers  


Categories