Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication4
- {
- abstract class Coin
- {
- public double Value { get; private set; }
- protected Coin(double value)
- {
- this.Value = value;
- }
- public abstract double Convert();
- }
- class cent : Coin
- {
- public cent(double val)
- : base(val)
- {
- }
- public override double Convert()
- {
- return base.Value * 30;
- }
- public abstract class Program
- {
- static cent sum(Coin c1, Coin c2)
- {
- int ans = c1.Value+c2.Value;
- return ans;
- }
- static void Main(string[] args)
- {
- Coin c1 = new cent(50.1);
- Coin c2 = new cent(20);
- Coin c = sum(c1, c2);
- Console.WriteLine(c);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement