Lesson 17 of 24

Inheritance

10 min 35 XP

class Car : public Vehicle ನಿಂದ Car ಗೆ Vehicle ನ public ಮತ್ತು protected members ಸಿಗುತ್ತವೆ. Derived constructor ತನ್ನ initializer list ನಲ್ಲಿ base constructor ಅನ್ನು call ಮಾಡುತ್ತದೆ. C++ multiple inheritance ಅನ್ನೂ support ಮಾಡುತ್ತದೆ.

Example: edit me and press Run

Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.

Challenge

+35 XP

Base class Employee (name, salary, salary ಹಿಂದಿರುಗಿಸುವ double pay()) ಮತ್ತು ಹೆಚ್ಚುವರಿ bonus ಹಾಗೂ salary + bonus ಹಿಂದಿರುಗಿಸುವ payWithBonus() ಇರುವ Manager : public Employee ಬರೆಯಿರಿ. main() ನಲ್ಲಿ name, salary ಮತ್ತು bonus ಓದಿ print ಮಾಡಿ: Input: Ravi 50000 7500 Output: Ravi base pay: 50000 Ravi total pay: 57500

Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.