Php oops Concepts
Hello Friends
Web In Hindi Me Apka Swaggat Hai Ajj Me Apko Php Inheritance Ke Bare Me Btaunga. Jo Ki
Php Inheritance
Kya Hai-Jab Ek Class
Ke Objects Dwara Dusre Class Ke Objects Ke Properties Ko Inherit Kiya Jata Hai
To Use Inheritance Kaha Jata Hai.
Php Me
Inheritance Ka Use Extends Keyword Ke Sath Kiya Jata Hai.
Example(Bina
Inheritance Ke)
class A{
public $model;
public $color;
}
class B{
public $model;
public $color;
public $size;
}
Example With
Inheritance
class A{
public $model;
public $color;
}
class B extends
A{
public $size;
}
Jesa Aap
Example Me Dekh Rhe Ho Ki Hmare Pass Do Classes Hai A And B
Hmare Pass A
Class Ke Object Hai Model Aur Color
Or B Class
Ke Ojects Hai Model,Color,Size To Apne
Without Inheritance Ke Example Me Dekha Hoga Ki Hmare Pass Do Objects Same Hai
Or Hme Unhe Bar Bar Likhna Pd Raha Hai
Bt Hmare Is
Problem Ko Inheritance Dwara Dur Kiya Jata Hai
Inheritance Wale
Example Me Hmne Sirf Class B Me Extends Keyword Use Ki Hai Jiske Karan Hme Same
Object Properties Dobara Ne Likhni Pdi Code Me.
Yanha Par Class
A Ko Perent Class Kaha Jata Hai
Class B Ko
Child Class Kiunki Class B Class A Ki Properties Ko Inherit Kr Rhe Hai
Hm Inheritance(inheritance in php) Ka Use Kiu Kare-
- · Isse Hmara Code Simple Or Short Bn Jata Hai(Code Complicated) Nhi Rehta.
- · Ye Hme Reusability Ka Feature Deta Hai Means Hm Ek Bar Class Bnake Uska Bar Bar Use Kr Skte Hai Hme Code Bar Bar Likhne Ki Jrrurt Ni Pdti
- · Ye Hmara Time Save Krti Hai.
Me Umid Karta Hu Ki Apko Hmara php oops tutorial Ka Inheritance Concept Acha Laga Hoga Dosto Apko
Agar Inheritance Se Related Koi Be Problem Arhe Hai To Plz Comment Me Apne
Problem Btaiye .
Thank You
Team Gajabwap
Web In Hindi
Also Read
ConversionConversion EmoticonEmoticon