-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClassesProperties.cs
43 lines (39 loc) · 1.07 KB
/
ClassesProperties.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
using System;
namespace hello_world {
public class Employee {
public string Name {get; set;}
protected double vacationDays = 0;
public virtual void TakeVacation() {
}
public Employee(string name) {
Name = name;
}
public override string ToString() {
return $"[Employee: Name = {Name}]";
}
}
public class Worker : Employee {
public double HourlyWage {get; set;}
public Worker(string name, double wage) : base(name) {
HourlyWage = wage;
}
public override void TakeVacation() {
vacationDays += 10;
}
public override string ToString() {
return $"[Employee: Name = {Name}, VacationDays = {vacationDays}]";
}
}
public class Manager : Employee {
public bool CompanyCar {get; set;}
public Manager(string name, bool hascar) : base(name) {
CompanyCar = hascar;
}
public override void TakeVacation() {
vacationDays += 15;
}
public override string ToString() {
return $"[Employee: Name = {Name}, VacationDays = {vacationDays}, HasCar = {CompanyCar}]";
}
}
}