Now that we have our Base
class created, let's create a User
class that will house the properties and functions for all things related to users.
1. Create a new file called
user.php
, and place it in theclasses
folder along withbase.php
.2. Let's create a class that extends our
Base
class.<?php class User extends Base { }
3. Let's add the two properties that we know we need so far:
name
andemail
, into ourUser
class.<?php class User extends Base { protected $name; protected $email; }
4. Let's add a
__construct
function that will tell ourBase
class that our document type isuser
on creation.