Lesson 17 of 24

Inheritance

10 min 35 XP

class Car : public Vehicle என்றால் Car, Vehicle-ன் public மற்றும் protected உறுப்புகளைப் பெறும். Derived constructor, base constructor-ஐ initializer list-ல் அழைக்கும். C++ multiple inheritance-ஐயும் ஆதரிக்கிறது.

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

Employee base class: name, salary; double pay() salary-ஐத் தரும். Manager : public Employee, கூடுதல் bonus; payWithBonus() salary + bonus. 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.