-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathUser.cs
More file actions
42 lines (35 loc) · 1.04 KB
/
Copy pathUser.cs
File metadata and controls
42 lines (35 loc) · 1.04 KB
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
namespace CsCodeExample;
public interface Employee
{
decimal Sallary { get; set; }
string Company { get; set; }
int YearsOfService { get; set; }
decimal CalculateSallaryCoeficiente();
}
//public partial class User // keyword: partial
public class User : Person, Employee // Inheritance Class (Parent - Child), Implements Interface
{
public string UserName { get; set; }
public string Email { get; set; }
protected string Password { get; set; }
public string Company { get; set; }
public int YearsOfService { get; set; }
public decimal Sallary { get; set; }
public void ResetPassword(string pass)
{
if (pass.Length < 8)
throw new Exception("Password must have at least 8 characters.");
Password = pass;
}
public override string ToString()
{
return String.Format("{0} ({1})", base.ToString(), Company);
}
public decimal CalculateSallaryCoeficiente()
{
if (YearsOfService < 10)
return 1;
else
return 1.5m;
}
}