Last active
March 30, 2016 13:19
-
-
Save gubi/cf69c7915e111f4d2416623573981f97 to your computer and use it in GitHub Desktop.
Code sample for the blog post: http://iod.io/Post/4/Abstract_classes_and_Interfaces-a_clear_explanation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface PhilosophicalContexts { | |
/** | |
* The concept of Property | |
* @see http://www.iep.utm.edu/prop-con/ | |
*/ | |
public function Property(); | |
} | |
interface PhilosophicalTheories extends PhilosophicalContexts { | |
/** | |
* The John Locke's Labour theory of property | |
* @see https://en.wikipedia.org/wiki/John_Locke | |
*/ | |
public function LabourTheory(); | |
/** | |
* The Adam Smith's theory of "invisible hand" | |
*/ | |
public function InvisibleHand(); | |
} | |
/** | |
* Now the class that implements above Interfaces | |
*/ | |
class Economics implements PhilosophicalTheories { | |
/** | |
* The concept of Property | |
*/ | |
public function Property() { | |
$this->context = "Economics"; | |
$this->definition = "The ownership of goods"; | |
return $this; | |
} | |
/** | |
* The John Locke's Labour theory of property | |
*/ | |
public function LabourTheory() { | |
$this->author = "John Locke"; | |
$this->definition = "God granted dominion over nature, and the man acquires the property with its work (by the relationship with the manipuled part of nature)"; | |
return $this; | |
} | |
/** | |
* The Adam Smith's Invisible Hand theory of property | |
*/ | |
public function InvisibleHand() { | |
$this->author = "Adam Smith"; | |
$this->definition = "All the economics properties are given by God, and supply and demand are 'led by an invisible hand'"; | |
return $this; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment