@@ -70,6 +70,7 @@ echo $bmw->hello(); // beep
70
70
echo "<br />";
71
71
echo $mercedes->hello(); // beep
72
72
```
73
+ [ π Back to contents] ( #table-of-contents )
73
74
74
75
### $this keyword
75
76
@@ -113,6 +114,7 @@ $mercedes->comp = "Mercedes Benz";
113
114
echo $bmw->hello();
114
115
echo $mercedes->hello();
115
116
```
117
+ [ π Back to contents] ( #table-of-contents )
116
118
117
119
### Method Chaining
118
120
@@ -154,6 +156,7 @@ $tank = $bmw->fill(10)->ride(40)->tank;
154
156
// Print the results to the screen.
155
157
echo "The number of gallons left in the tank: " . $tank . " gal.";
156
158
```
159
+ [ π Back to contents] ( #table-of-contents )
157
160
158
161
### Access Modifier
159
162
@@ -189,6 +192,7 @@ $mercedes->setModel("Mercedes benz");
189
192
//Gets the carβs model
190
193
echo $mercedes->getModel();
191
194
```
195
+ [ π Back to contents] ( #table-of-contents )
192
196
193
197
### Magic Method and Constant
194
198
@@ -221,6 +225,7 @@ $car1 = new Car('Mercedes');
221
225
222
226
echo $car1->getCarModel();
223
227
```
228
+ [ π Back to contents] ( #table-of-contents )
224
229
225
230
## Inheritance
226
231
@@ -261,6 +266,7 @@ $sportsCar1->setModel('Mercedes Benz');
261
266
// Get the class model name
262
267
echo $sportsCar1->hello();
263
268
```
269
+ [ π Back to contents] ( #table-of-contents )
264
270
265
271
### Override
266
272
@@ -306,6 +312,7 @@ $sportsCar1 = new SportsCar();
306
312
// Get the result of the hello method
307
313
echo $sportsCar1->hello();
308
314
```
315
+ [ π Back to contents] ( #table-of-contents )
309
316
310
317
### Abstract Class and Method
311
318
@@ -353,6 +360,7 @@ $toyota1->setTankVolume(10);
353
360
echo $toyota1->calcNumMilesOnFullTank();//330
354
361
echo $toyota1->getColor();//beige
355
362
```
363
+ [ π Back to contents] ( #table-of-contents )
356
364
357
365
### Interface
358
366
@@ -412,6 +420,7 @@ class miniCar implements Car, Vehicle
412
420
}
413
421
}
414
422
```
423
+ [ π Back to contents] ( #table-of-contents )
415
424
416
425
### Polymorphism
417
426
@@ -467,6 +476,7 @@ $rect = new Rectangle(3, 4);
467
476
echo $circ->calcArea();
468
477
echo $rect->calcArea();
469
478
```
479
+ [ π Back to contents] ( #table-of-contents )
470
480
471
481
### Type Hinting
472
482
@@ -529,6 +539,7 @@ $car1->setHasSunRoof(true);
529
539
$car1->setNumberOfDoors(4);
530
540
$car1->setPrice(1234.56);
531
541
```
542
+ [ π Back to contents] ( #table-of-contents )
532
543
533
544
### Static Method and Property
534
545
@@ -558,6 +569,7 @@ echo Utilis::$numCars;
558
569
Utilis::addToNumCars(-1);
559
570
echo Utilis::$numCars;
560
571
```
572
+ [ π Back to contents] ( #table-of-contents )
561
573
562
574
### Trait
563
575
@@ -599,4 +611,5 @@ $o = new MyHelloWorld();
599
611
$o->sayHello();
600
612
$o->sayWorld();
601
613
$o->sayExclamationMark();
602
- ```
614
+ ```
615
+ [ π Back to contents] ( #table-of-contents )
0 commit comments