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

Write a program to reverse a linked list?

8 Answers   Catalytic Software, Satyam,


What is constructor in C++?

0 Answers  


can anybody please tell me how to write a program in c++,without using semicolon(;)

6 Answers   NIIT,


What is your strongest programming language (Java, ASP, C, C++, VB, HTML,C#, etc.)?

24 Answers   Infosys, Microsoft, TCS,


What are the advantages of prototyping?

0 Answers  






Why is c++ is better than c?

0 Answers  


Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == ) y-= 7; else y = 8; if the value of x is 4 before the nested IFs are executed, what is the value of y after the nested IFs are executed?

0 Answers  


declare an array of structure where the members of the structure are integer variable float variable integer array char variable access all elements of the structure using dot operator and this pointer operator

0 Answers  


What is the object serialization?

0 Answers  


Mention the ways in which parameterized can be invoked. Give an example of each.

0 Answers  


What is c++ hiding?

0 Answers  


Why namespace is used in c++?

0 Answers  


Categories