mirror of
https://github.com/restoreddev/phpapprentice.git
synced 2025-08-05 06:17:37 +02:00
Wrote inital content for classes-visibility and tweaked classes page
This commit is contained in:
@@ -24,9 +24,15 @@ $bike = new Bicycle();
|
||||
$bike->color = 'Blue';
|
||||
echo $bike->color . "\n";
|
||||
|
||||
// An instance of a class is called an object. Congratulations!
|
||||
// You are now performing object-oriented development.
|
||||
$redBike = new Bicycle();
|
||||
$redBike->color = 'Red';
|
||||
echo $redBike->color . " Bike Object\n";
|
||||
|
||||
// A method is a function attached to the class. You can add a method
|
||||
// to a class by using the "public" keyword followed by the function. A method
|
||||
// can access the attributes and methods of the instance using the "$this" variable.
|
||||
// can access the attributes and methods of an object instance using the "$this" variable.
|
||||
class Tricycle
|
||||
{
|
||||
public $color;
|
||||
|
Reference in New Issue
Block a user