Advertisement
minnera

#30daysofcode #day13

Oct 15th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.45 KB | None | 0 0
  1. //https://www.hackerrank.com/challenges/30-abstract-classes/problem
  2.  
  3. //Write MyBook class
  4. class MyBook : Book
  5. {
  6.     protected int price;
  7.    
  8.     public MyBook(String title, String author, int price) : base(title, author){      
  9.       this.price = price;
  10.     }
  11.    
  12.     public override void display(){
  13.       Console.WriteLine("Title: " + title);
  14.       Console.WriteLine("Author: " + author);
  15.       Console.WriteLine("Price: " + price);
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement