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.