Untitled

 avatar
unknown
csharp
a year ago
942 B
3
Indexable
// Online C# Editor for free
// Write, Edit and Run your C# code using C# Online Compiler

using System;

public class HelloWorld
{
    public static void Main(string[] args)
    {
        //Cannot create an instance of the abstract class
        //Customer customer = new Customer(); //Gives Error
        //customer.CalculateDiscount();//Gives Error
        Console.WriteLine ("Hello, World!");
    }
}
//Cannot create an instance of the abstract class
public interface ICustomer {
     string name {get;set;}
     string address {get;set;}
     string productName {get;set;}
     decimal productAmount {get;set;}
     decimal CalculateDiscount();
}

public class SilverCustomer : ICustomer{
    public override decimal CalculateDiscount(){
        return productAmount-5;
    }
}

public class GoldCustomer : ICustomer{
public override decimal CalculateDiscount(){
        return productAmount-10;
    }
}
Editor is loading...
Leave a Comment