repl.it
@kironroy/

abstractclasses3

C#

No description

fork
loading
Files
  • main.cs
  • main.exe
main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
// https://gist.github.com/kironroy/89b86db2691110fcbc8b181ca982cac3

namespace CoreyAbstractClassHW
{
    class Program
    {
        static void Main(string[] args)
        {
            Pliers pliers = new Pliers
            {
                PliersType = "Needle nose",
                SerialNumber = "201ef3",
                Manufacturer = "Channel Lock"

            };

            Console.WriteLine(); // breakline
           
            Console.WriteLine($"The product is a {pliers.PliersType} plier the serial number is \n" +
                $"{pliers.SerialNumber} and the manufacturer is {pliers.Manufacturer}");

            Console.ReadLine();
        }
    }
     
    public interface IProductData
    {
        string SerialNumber { get; set; }
        string Manufacturer { get; set; }
    }

    public abstract class HomeImprovement : IProductData
    {
        public abstract string SerialNumber { get; set; }
        public abstract string Manufacturer { get; set; }
    }

    public class Pliers : HomeImprovement
    {
        public string PliersType { get; set; }
        public override string SerialNumber { get; set; }
        public override string Manufacturer { get; set; }
    }


}