Abstract Classes

  • + 0 comments

    PHP Solution

    class MyBook extends Book {
    
        protected $price;
    
        function __construct($title,$author,$price) {
            Book::__construct($title, $author);
            $this->price = $price;
        }
        
        function display() {
            echo "Title: {$this->title}";
            echo "Author: {$this->author}";
            echo "Price: {$this->price}";
        }
    }
    

    }