INHERITANCE - Object-Oriented Programming (OOP) Inheritance என்பது OOP-ன் முக்கியமான concepts-ல் ஒன்ற……
INHERITANCE – Object-Oriented Programming (OOP)
Inheritance is the mechanism by which one class acquires the properties and behaviors of another class. தமிழில்: ஒரு class-ல் இருக்கும் data members மற்றும் member functions-ஐ மற்றொரு class பெறும் OOP mechanism தான் Inheritance. Simple for…
Inheritance is the mechanism by which one class acquires the properties and behaviors of another class. தமிழி……
ஒரு Person class இருக்கிறது என்று வைத்துக்கொள்வோம். Person name age display() இப்போது Student என்பதும் ஒரு Pe……
Consider: Vehicle Vehicle-க்கு: speed colour start() stop() இப்போது: Car Bike Bus இவை அனைத……
Inheritance-ல் இரண்டு முக்கிய……
Base Class
எந்த class-லிருந்து properties inherit செய்யப……
Derived Class
Base class-ன் properties-ஐ inherit செய்யும் class: Derived ……
Person ↓ Student இதில்: Person → Ba……
இதில்: Student → Derived class Person → ……
string name;…
int mark;…
return 0; }…
Base Class class Person Person என்பது base class. Inside: string name; name என்பது Person class-ன் data membe……
Object: Student s1; உருவாகிறது. Student class-க்கு அதன் own member: mark displayMark() இருக்கிறது. Inheritanc……
WHY INHERITANCE?
Inheritance ஏன் பயன்படுத்த வே……
1. Code Reusability
Already written code-ஐ மீண்டும் பயன்படுத்தலாம். Without inheritance: Person name Student name Teacher name Em……
2. REDUCES CODE DUPLICATION
Repeated code குறையும். Without inherit……
3. EASY MAINTENANCE
Base class-ல் common functionalit……
4. EXTENSIBILITY
Existing class-ஐ modify செய்ய……
Vehicle ↓ ElectricCar Vehicle……
SUPPORTS POLYMORPHISM
Inheritance runtime polymorphism-க்கு முக்கிய foundation. Especially: Base class pointer + Virtual function +……
Exam-க்கு மிக முக்கியம்.…
C++-ல் inheritance பல வகைகள் ……
1. Single Inheritance 2. Multilevel Inheritance 3. Multi……
ஒரு derived class ஒரு base clas……
return 0; }…
MULTILEVEL INHERITANCE
ஒரு class இன்னொரு class-ஐ inherit ச……
LivingThing | Animal | Dog…
Son object: Son s; Grandfathe……
MULTIPLE INHERITANCE
ஒரு derived class இரண்டு அல்லது அதற்கு மேற்பட்ட ba……
return 0; }…
HIERARCHICAL INHERITANCE
ஒரு base class-லிருந்து multi……
Animal / \ Dog Cat…
Both: Dog d; Cat c; can use: ……
HYBRID INHERITANCE
Two or more inheritance types combination ஆக இருப்பது: Hybrid Inheritance A / \ B C \ / D இதில் hierarchical ……
and…
என்று பயன்படுத்தி diamond duplication-ஐ avoid செய்யலாம். ……
1. public inheritance 2. prot……
Suppose Base contains: public……
Then: Base public → Derived private Base protected ……
இந்த table TRB/NET MCQ-க்கு மிகவும் முக்……
B object-க்குள் base subobjec……
என்று directly access செய்ய முடியாது. HOW TO……
int x; public:…
Derived object: B b; b.setX(10); பயன்படுத்த முடியும், ass……
int x; }; Derived class:…
இது valid. ஆனால் outside: B b; b.x = 20; invalid. PUBLIC vs PROTECTED vs PRIVATE public → Everyone with acces……
Object: B obj;…
Derived object உருவாகுவதற்கு முன்னால் அதன் base portion properly initialize ஆக வேண்டும். Flow: Base Construct……
Then: Dog d; d.eat(); valid. ……
Dog d; d.sound();…
இது function overriding-ன் basic idea. V……
Memory: Encapsulation → Wrap ……
Inheritance பற்றிய முக்கிய points: Inheritance supports code reusability. Existing class = Base class. New cl……
Wrong inheritance syntax Wrong: class ……
Direct access to private base member class A { private……
Confusing IS-A with HAS-A Car IS-A Vehicle Co……
Thinking derived class gets unrestricted access Inheritan……
Inheritance = Receive Child class: Receives/reuses features from Parent class Another trick:……
What is inheritance? Answer: Inheritance is the mecha……
Which OOP feature provides co……
The class whose properties ar……
The class that inherits anoth……
Inheritance represents which ……
Does C++ support multiple inh……
Which access specifier is main……
Which constructor executes fi……
Which destructor executes fir……
What is inheritance? Inheritance is an OOP mechanism in which a derived class acquires and extends the access……
Which OOP feature provides re……
A class whose members are inh……
A class that inherits another……
Which relationship is represe……
Which is correct syntax?…
Which inheritance has one bas……
One derived class inheriting ……
One base class with many deri……
A → B → C represents:…
Which C++ access level allows a derived class t……
Constructor execution order i……
Destructor execution order is:…
Consider: class Person { public: string name; }; class Student : public Person { public: int mark; }; Identif……
INHERITANCE | |-- OOP Concept | |-- Code Reusability | |-- Base Class | |-- Derived Class | |-- IS-A Relation……
Inheritance என்பது ஒரு existing Base Class-ன் accessible properties மற்றும் member functions-ஐ Derived Class ……