Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- // Demo Class for running purposes
- public class Program
- {
- public static void Main()
- {
- Console.WriteLine(
- "Start Building a House"
- );
- // Create Room
- Room myRoom = new Room("My Room");
- // Output Room's Details
- Console.WriteLine(myRoom.ToString());
- }
- }
- // Class with Inherited Abstract Class
- class Room : Location
- {
- public Room(String name) : base(name)
- {
- // Class constructor with inherited base constructor used
- }
- public override string ToString()
- {
- return Name;
- }
- }
- // Abstract Class provides basic structure details
- abstract class Location
- {
- public string Name { get; private set; }
- public Location(string name)
- {
- this.Name = name;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement