SHARE
TWEET

Untitled

a guest Jul 17th, 2019 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. // Demo Class for running purposes
  4. public class Program
  5. {
  6.     public static void Main()
  7.     {
  8.         Console.WriteLine(
  9.             "Start Building a House"
  10.         );
  11.  
  12.         // Create Room
  13.         Room myRoom = new Room("My Room");
  14.  
  15.         // Output Room's Details
  16.         Console.WriteLine(myRoom.ToString());
  17.     }
  18. }
  19.  
  20. // Class with Inherited Abstract Class
  21. class Room : Location
  22. {
  23.     public Room(String name) : base(name)
  24.     {
  25.         // Class constructor with inherited base constructor used
  26.     }
  27.  
  28.     public override string ToString()
  29.     {
  30.         return Name;
  31.     }
  32. }
  33.  
  34. // Abstract Class provides basic structure details
  35. abstract class Location
  36. {
  37.     public string Name { get; private set; }
  38.     public Location(string name)
  39.     {
  40.         this.Name = name;
  41.     }
  42. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top