Skip to content

Instantly share code, notes, and snippets.

@recck
recck / oop.php
Created October 29, 2012 13:38
Programming in PHP - Week 7 - Day 13 - OOP
<?php
class FirstClass {
public $public;
protected $protected;
private $private;
public function __construct($public, $protected, $private){
$this->public = $public;
$this->protected = $protected;
@recck
recck / Car.php
Created November 1, 2012 15:09
Programming in PHP - Week 7 - Day 14 - OOP Part 2
<?php
include 'Vehicle.php';
class Car implements Vehicle {
private $seats;
private $type;
public function __construct($seats, $type){
$this->seats = $seats;
$this->type = $type;
@recck
recck / gist:3994213
Created November 1, 2012 15:11
Programming in PHP - OOP Write Up
Car and Garage Classes
IDEA:
A Garage of size n can store up to n Cars
A Garage is treated like a stack, where you can push and pop Cars "in" and "out" of your Garage
A Car is treated as an individual that gets stored inside the Garage
The Garage class:
Must be constructed with a name and a size.
The size is the amount of Cars the Garage can hold.