add overriding

This commit is contained in:
2023-07-01 17:01:12 +02:00
parent 71fb61f6dc
commit 0c80706a4b
4 changed files with 12 additions and 22 deletions
-17
View File
@@ -1,17 +0,0 @@
namespace TicketSystem.Tickets
{
public class Adult: Ticket
{
public int price { get; }
public Adult()
{
price = 20;
}
public int PriceWithReduction()
{
return price - price/100*20;
}
}
}
+11 -3
View File
@@ -7,9 +7,17 @@
Adult
}
public interface Ticket
public class Ticket
{
int price { get; }
int PriceWithReduction();
public int price { get; }
public Ticket()
{
price = 20;
}
public int PriceWithReduction()
{
return price - price/100*20;
}
}
}