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

Do vectors start at 0?

0 Answers  


Is c++ high level programming language?

0 Answers  


State two differences between C and C++.

0 Answers   Hexaware,


What is helper in c++?

0 Answers  


what does the following statement mean? int (*a)[4]

0 Answers  






why can't we declare data member of class auto register or extern

1 Answers  


Why do we use using namespace std in c++?

0 Answers  


Can comments be nested?

0 Answers  


Why pointer is used in c++?

0 Answers  


structure that describe a hotel with name, address,rooms and number of rooms

2 Answers  


What do you mean by public protected and private in c++?

0 Answers  


Write a C program to calculate the salary of each employee in your company. You need to input the hours worked and the hourly rate. The company pays 1.5 times the hourly rate for all hours worked in excess of 48 hours. Use the formulas below to calculate the salary: if employee worked less than 48 hours salary = hours * rate; if employee worked more than 48 hours salary = 48.0 * rate + ( hours &#8722; 48.0 ) * rate * 1.5; You are required to use a loop to produce the sample output as given below.

1 Answers  


Categories