Is structure can be inherited?
Answers were Sorted based on User's Feedback
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 |
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 |
Answer / sabu
Everything for what a class is implemented holds good for
structure also in C++.
| Is This Answer Correct ? | 8 Yes | 4 No |
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 |
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 |
How many types of casting are there in C++? When is a dynamic cast,static_cast,reinterpret cast used?
How do you save a c++ program?
What is setf in c++?
I need to find a specific string between two strings how do I do it?
What is the meaning of string in c++?
Where and why do I have to put the "template" and "typename" keywords?
Can we use this pointer in a class specific, operator-overloading function for new operator?
What does the following do: for(;;) ; a) Illegal b) Loops forever c) Ignored by compiler...not illegal
What is the difference between an array and a list?
What are register variables?
What is iterator c++?
Why do we need runtime polymorphism in c++?