Last active
October 7, 2015 12:55
-
-
Save tacoberu/f1742b794d1546342bfe to your computer and use it in GitHub Desktop.
Jak přidat do existující třídy novou funkcionalitu.
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 | |
class Int | |
{ | |
function __construct($blob) | |
{} | |
function plus(Int $m){} | |
function minus(Int $m){} | |
} | |
class IncInt extends Inc | |
{ | |
function __construct(Int $pattern) | |
{} | |
function inc(){} | |
} | |
$a = new Int(1); | |
$b = new Int(2); | |
$c = new IncInt(3); | |
(new IncInt($a))->inc(); | |
(new IncInt($b))->inc(); | |
$c->inc(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment