Home / Yii / Yii Framework – Encapsulation and Inheritance

Yii Framework – Encapsulation and Inheritance

Yii Framework – Encapsulation and Inheritance

Video 2 : Understanding Encapsulation and Inheritance Concepts – Yii Framework for Beginners

Encapsulation

Wrapping the related member variable and member functions together

class A {

$a = 10; // member variable

$b = 20; // member variable

function add($a, $b){ //logic }

function substract($a, $b){ //logic }

}

Best Example for encapsulation is  “Class”

 

Inheritance

“Aquaring the Parent Properties to Child Class”

Example : Mother   Father (Rich) 100 MD Kid (D+ KP) 10MD +100 =110 MD


class A {

$a = 10; // member variable

$b = 20; // member variable

function add($a, $b){ //logic }

function substract($a, $b){ //logic } ...

}

class B extends A {

add(10,2);

}

About Mohammad Fareed

Software Engineer @ Tekzenit.

Check Also

How to remove index.php and ?r= in Yii Framework

Hi guys in this article you are going to see “How to remove index.php and …

Leave a Reply

Your email address will not be published. Required fields are marked *