---
title: "Effect of derivation types on class members"
subject: "Object Oriented Programming"
chapter: 6
key: "semester_3/object_oriented_programming:derivation-types-effect"
source: https://www.bctengineer.com/q/semester_3/object_oriented_programming/derivation-types-effect
site: BCT Engineering
---

# Effect of derivation types on class members

Object Oriented Programming · Chapter 6: Inheritance

- Asked in: 2069 Chaitra, 2+2 marks
- Video: [Private Protected Public Inheritance in C++  | C++ Programming | In Hindi](https://www.youtube.com/watch?v=-pGxDj8B3GU) — codeitup
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_3/object_oriented_programming/derivation-types-effect
- Whole chapter: https://www.bctengineer.com/md/semester_3/object_oriented_programming/chapter-6

## Question

How do different types of derivation affect the members of class? Write down the types of inheritance.

## Short answer

Derivation mode (public, protected, private) determines how base members are inherited: public derivation keeps public as public; protected makes both public and protected into protected; private makes them private. Inheritance types: single, multiple, multilevel, hierarchical, hybrid.

## Answer

#### Effect of the type of derivation
The derivation mode (`public`, `protected`, `private`) decides how the base class members are seen in the derived class and outside it. Private members of the base are never directly accessible in the derived class in any mode.

| Base member | public derivation | protected derivation | private derivation |
|---|---|---|---|
| public | public | protected | private |
| protected | protected | protected | private |
| private | not accessible | not accessible | not accessible |

- **Public:** "is-a" relation; the public interface of the base remains public.
- **Protected:** base public and protected members become protected, usable only in the derived class and its children.
- **Private:** all accessible base members become private in the derived class (the default for `class`).

Example: `class D : public B {};` keeps B's public members public in D.

#### Types of inheritance

1. **Single** - one base, one derived class: `A -> B`.
2. **Multiple** - a derived class has two or more base classes: `A, B -> C`.
3. **Multilevel** - a chain: `A -> B -> C`.
4. **Hierarchical** - several derived classes from one base: `A -> B, A -> C`.
5. **Hybrid** - a combination of the above (e.g. diamond).

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. With class D : public B, what is the access of B's protected members inside D?
   A. public
   B. private
   C. protected
   D. not accessible
   Answer: C. Public derivation keeps public members public and protected members protected. (Key point: Public derivation)

2. With class D : private B, how do B's public and protected members appear in D?
   A. Both stay as they were
   B. Both become private
   C. Both become protected
   D. Both become public
   Answer: B. Private derivation makes all accessible base members private in the derived class. (Key point: Private derivation)

3. What happens to private members of the base class in any derivation mode?
   A. They are never directly accessible in the derived class
   B. They become public with public derivation
   C. They become protected in the derived class
   D. They are accessible only with private derivation
   Answer: A. Private members of the base are never directly accessible in the derived class, whatever the mode. (Key point: Base private members)

4. Which type of inheritance is A -> B -> C?
   A. Hierarchical
   B. Multilevel
   C. Multiple
   D. Single
   Answer: B. A chain of derivations A -> B -> C is multilevel inheritance; hierarchical has several derived classes from one base. (Key point: Types of inheritance)

## Related in Object Oriented Programming

- [Access overridden members from derived class](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Aaccess-overridden-members) — Object Oriented Programming, chapter 6, asked 2×
- [Multipath inheritance problem and solution](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Amultipath-inheritance-problem) — Object Oriented Programming, chapter 6, asked 2×
- [Time class: add two objects](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Atime-class-add-objects) — Object Oriented Programming, chapter 1
- [LandMeasure class and sum function](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Alandmeasure-class-sum) — Object Oriented Programming, chapter 4
- [Distance class relational operators](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Adistance-relational-overload) — Object Oriented Programming, chapter 5
- [Class and function template with syntax](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Aclass-function-template-syntax) — Object Oriented Programming, chapter 9, asked 4×

## Related in other subjects

- [Image charge derivation for Schottky effect](https://www.bctengineer.com/question.md?key=semester_3%2Felectrical_engineering_material%3Aschottky-image-charge) — Electrical Engineering Material, chapter 2, asked 2×
- [Quadrilateral speed-time curve on down gradient](https://www.bctengineer.com/question.md?key=semester_7%2Futilization_of_electrical_energy%3Aquadrilateral-curve-down-gradient-energy) — Utilization of Electrical Energy, chapter 4
- [Video rental shop class diagram](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Avideo-rental-class-diagram) — Object Oriented Analysis and Design, chapter 2
- [Maximum switching overvoltage derivation](https://www.bctengineer.com/question.md?key=semester_8%2Fhigh_voltage_engineering%3Aswitching-overvoltage-max-derivation) — High Voltage Engineering, chapter 3, asked 2×
