"HR30 Day 13: Abstract Classes"의 두 판 사이의 차이

(새 문서: ==개요== ;<nowiki>Day 13: Abstract Classes</nowiki> * https://www.hackerrank.com/challenges/30-abstract-classes/problem {{HR30 헤더}} {{HR30 10-19}} |} ==PHP== <source lang='php...)
 
8번째 줄: 8번째 줄:


==PHP==
==PHP==
{{참고|HR30 Day 13: Abstract Classes/PHP}}
<source lang='php'>
<source lang='php'>
class MyBook extends Book
{
    protected $price;
    function __construct($title, $author, $price) {
        parent::__construct(trim($title), trim($author));
        $this->price = $price;
    }
    function display() {
        echo 'Title: ' . $this->title . "\n";
        echo 'Author: ' . $this->author . "\n";
        echo 'Price: ' . $this->price . "\n";
    }
}
</source>
</source>

2018년 8월 10일 (금) 02:03 판

1 개요

Day 13: Abstract Classes
해커랭크 30 Days of Code
문제 풀이
10-19 Day e
HR30 Day 10: Binary Numbers

HR30 Day 11: 2D Arrays

HR30 Day 12: Inheritance

HR30 Day 13: Abstract Classes

HR30 Day 14: Scope

HR30 Day 15: Linked List

HR30 Day 16: Exceptions - String to Integer

HR30 Day 17: More Exceptions

HR30 Day 18: Queues and Stacks

HR30 Day 19: Interfaces

2 PHP

class MyBook extends Book
{
    protected $price;
    function __construct($title, $author, $price) {
        parent::__construct(trim($title), trim($author));
        $this->price = $price;
    }
    function display() {
        echo 'Title: ' . $this->title . "\n";
        echo 'Author: ' . $this->author . "\n";
        echo 'Price: ' . $this->price . "\n";
    }
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}