Rules of inheritance, C/C++ Programming

Assignment Help:

Rules of Inheritance:

  • Private members are not inherited; the members can be accessed only within its class. It cannot be used through the object.
  • Protected members are inherited; but it can be used only within the base and inherited derived class. It cannot be accessed through the object.
  • Public members are inherited, and public members only can be accessed inside the class as well as outside the class through objects.
  • The private member and protected member can be accessed outside the class indirectly, that is passing these members in the public members.
  • Class inherited as private will make all the members of the base class as private in the derived class; and it has to follow the rules of private member to access.
  • Class inherited as protected will make all the members of the base class as protected in the derived class; and it has to follow the rules of protected member to access.
  • Class inherited as public will not make any changes to the members of base class in the derived class.
  • The derived class cannot modify the original characteristic of its base class.
  • The multiple copies of same class may happen during multiple inheritances. This can be avoided by created virtual base class using "public virtual" key word this make only one copy to be inherited from base classes.
  • Constructor is not inherited but arguments can be passed from the derived class to the base class constructor using colon operator.
  • Objects be able to nested, and it is not inheritance.
  • When the base class and the derived class has the same member function name, only the derived class member can be accessed through derived class object. In this case the base class member function is overridden. The base class member function can be accessed through derived class object only through scope operator if the derived as public.

 

 


Related Discussions:- Rules of inheritance

Implementation of the dictionary class, Implementation of the Dictionary cl...

Implementation of the Dictionary class: int Dictionary::find_word(char *s) {    char word[81];    for (int i = 0; i       if (stricmp(words[i].get_word(word),s) =

C++, Write a program to find the area under the curve y = f(x) between x = ...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Structures of flowchart, Ask Draw a flowchart that print all even numbers f...

Ask Draw a flowchart that print all even numbers from 2 until 10

Explain the for loop - computer programming, Explain the For Loop - Compute...

Explain the For Loop - Computer Programming? Similar to the while statement, for loop is an entry controlled loop and the code of the for loop will be executed itereatively. Th

Describe run-time type identification, The ability to verify at run time th...

The ability to verify at run time the type of an object by using the typed operator or the dynamic_cast operator.

Programming Assignment 4, For this program, you are going to modify your pr...

For this program, you are going to modify your previous program (program 3) so that it will now have a menu to see if the user wants to read the input from a file or interactively.

Described the order that objects in an array is destructed?, Described the ...

Described the order that objects in an array is destructed?

We want network-social app, We are seeking a talented developer/team with g...

We are seeking a talented developer/team with great experience in programming apps for both Android and iOS. Our project needs great skills and experience in making good functional

Define the arithmetic operators in c language, Define the Arithmetic Operat...

Define the Arithmetic Operators in c Language? There are five arithmetic operators in C and they are Operator             Purpose +                        Addition -

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd