Last active
March 30, 2016 13:18
-
-
Save gubi/cf89c69efaa9eef07e78315712fdb34a 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 | |
abstract class Physics { | |
/** | |
* The Planck's law | |
* @param integer $J An integer that represent an energy measure | |
* @param integer $s An integer that represent a time measure | |
*/ | |
public static function Planck($J, $s) { | |
$h = 6.62607004 * pow(10, -34) * ($J * $s); | |
return $h; | |
} | |
/** | |
* The Quantum Mechanics method | |
* @param string $type Is this "deterministic"? | |
* @param string $elements Some definition elements | |
*/ | |
public static function QuatumMechanics($type, $elements) { | |
if($type == "deterministic") { | |
return "No randomness and " . $elements; | |
} | |
} | |
/** | |
* The Bohm Theory, pure abstract definition | |
*/ | |
abstract public static function BohmTheory(); | |
} | |
/** | |
* The class that extends the above abstract | |
*/ | |
class PhysicsTheories extends Physics { | |
/** | |
* Bohm Theory | |
* @return string Quantum mechanics data | |
*/ | |
public static function BohmTheory() { | |
return Physics::QuatumMechanics("deterministic", "non-local Universe") . ".\nUses also the Plack's law, which if J = 10 and s = 2 is the equivalent of " . Physics::Planck(10, 2); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment