0% found this document useful (0 votes)
37 views18 pages

OOP Di PHP

The document discusses object-oriented programming (OOP) concepts in PHP including classes, constructors, inheritance, function overriding, public, private and protected members, interfaces, constants, abstract classes, static and final keywords, and calling parent constructors. It provides examples to demonstrate each concept.

Uploaded by

MTs DDI Tarakan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views18 pages

OOP Di PHP

The document discusses object-oriented programming (OOP) concepts in PHP including classes, constructors, inheritance, function overriding, public, private and protected members, interfaces, constants, abstract classes, static and final keywords, and calling parent constructors. It provides examples to demonstrate each concept.

Uploaded by

MTs DDI Tarakan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

{OOP}

in PHP
Try OOP in PHP OOP in PHP in PHP P in PHPHP in PHP
(P in PHPokemon PHP case)
Basic OOP Concepts OOP Concepts Conc OOP Conceptsepts

1. Class (variable member, function member, object, call fun PHPction PHP member, function member, object, call object, function member, object, call call
fuction PHP)
2. Con PHPstructor Fun PHPction PHP
3. In PHPheritan PHPce (exten PHPds)
4. Fun PHPction PHP Overridin PHPg
5. P in PHPublic Members
6. P in PHPrivate Members
7. P in PHProtected Members
8. In PHPterfaces
9. Con PHPstan PHPt
10. Abstract Classes
11. Static Key OOP in PHPword
12. Fin PHPal Key OOP in PHPword
1. Class
2. Con PHPstructor Fun PHPction PHP

Comment /**/ all setter then create object

Output:
3. In PHPheritan PHPce

output :
4. Fun PHPction PHP Overridin PHPg
Fun PHPction PHP getHP in PHP in PHP child override fun PHPction PHP in PHP paren PHPt with same n PHPame.

Output :
5. P in PHPublic Members
By default var and functions is public, can be accessed outside class, within class, or another class.
6. P in PHPrivate Members
Example 1

Output

Example 2
call the function in evolve class *).
*) I’m not allowed to set directly the mood of the pokemon.

Output :
7. P in PHProtected members
Pokemon Class

Evolution Class extend Pokemon

output :
8. In PHPterfaces
Poke_Interface.php

Example 1 :

Output :

Example 2:
Output :

Example 3 :

Ouput :
9. Con PHPstan PHPt
Const vs Var

Example
Output :
10. Abstract Classes

Output :
11. Static Key OOP in PHPword

Output :
12. Fin PHPal Key OOP in PHPword

Ouput :
13. Callin PHPg P in PHParen PHPt con PHPstructor

Output:

You might also like