Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // create a folder called classes, inside it, create a file for each of your classes, eg event.php, client.php, etc
- // my accounts.phps sample below
- <?php
- class Account {
- private $id;
- private $name;
- private $email;
- private $password;
- public function __construct($name, $email, $password) {
- $this->name = $name;
- $this->email = $email;
- $this->password = $password;
- }
- public function setName($value){
- $this->name = $value;
- }
- public function getName(){
- return $this->name;
- }
- public function setEmail($value){
- $this->email = $value;
- }
- public function getEmail(){
- return $this->email;
- }
- public function setPassword($value){
- $this->password = $value;
- }
- public function getPassword(){
- return $this->password;
- }
- }
- ?>
- // sample client.php that will inherit from it
- <?php
- class Client extends Account {
- private $phone_number;
- private $address;
- public function __construct($name, $email, $phone_number, $address, $password) {
- parent::__construct($name, $email, $password);
- $this->phone_number = $phone_number;
- $this->address = $address;
- }
- public function setAddress($value){
- $this->address = $value;
- }
- public function getAddress(){
- return $this->address;
- }
- public function setPhoneNumber($value){
- $this->phone_number = $value;
- }
- public function getPhoneNumber(){
- return $this->phone_number;
- }
- public function display_details(){
- print "User name: ". $this->getName(). " <br />";
- print "User email: ". $this->getEmail() ." <br />";
- print "User phone number: $this->phone_number <br />";
- print "User address: $this->address <br />";
- }
- }
- ?>
- // EVENT.php sample
- <?php
- class Event {
- private $id;
- private $title;
- private $description;
- private $venue;
- private $date;
- private $package_id;
- private $created_at;
- public function __construct($id, $title, $description, $venue, $date, $package_id, $created_at) {
- $this->id = $id;
- $this->title = $title;
- $this->description = $description;
- $this->venue = $venue;
- $this->date = $date;
- $this->package_id = $package_id;
- $this->created_at = $created_at;
- }
- public function getId() { return $this->id; }
- public function getTitle() { return $this->title; }
- public function getDescription() { return $this->description; }
- public function getStartDate() { return $this->venue; }
- public function getEndDate() { return $this->package_id; }
- public function getCost() { return $this->date; }
- public function getLocationID() { return $this->created_at; }
- }
- ?>
- etc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement