コード例 #1
0
ファイル: class.php プロジェクト: rasko-lazic/learning-php
$try1 = new Test('OOP', 'how to learn OOP');
echo $try1->title . "<br>";
echo $try1->description . "<br>";
try {
    $try1->setValue(4);
} catch (Exception $ex) {
    echo $ex->getMessage();
}
//$try1->value=10;
echo $try1->getValue() . "<br><br>";
//(new Score('Inheritance test', 'how to learn inheritance'))->printValue();
$score1 = new Score('Inheritance test', 'how to learn inheritance');
echo $score1->title . "<br>";
echo $score1->description . "<br>";
try {
    $score1->setValue(4);
} catch (Exception $ex) {
    echo $ex->getMessage();
}
//SINCE ITS PUBLIC IN SUBCLASS->STILL ACCESSIBLE!!
$score1->value = 5;
$score1->printValue();
//$users=['rasko', 'admin', 'bot'];
//echo<<<HTML
//<method = "POST">
//         Username: <input type = "text" name = "user" />
//         <input type = "submit" />
//      </form>
//HTML;
//$_POST["user"]='******';
//if(isset($_POST["user"])) {