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;
- using System.Threading.Tasks;
- namespace CompanyHierarchy
- {
- public abstract class Person : IPerson
- {
- private int id;
- private string firstName;
- private string lastName;
- public Person(int personID, string personFirstName, string personLastName)
- {
- this.ID = personID;
- this.FirstName = personFirstName;
- this.LastName = personLastName;
- }
- public int ID
- {
- get
- {
- return this.id;
- }
- set
- {
- if (value < 0)
- {
- throw new ArgumentOutOfRangeException("ID cannot be negative!");
- }
- this.id = value;
- }
- }
- public string FirstName
- {
- get
- {
- return this.firstName;
- }
- set
- {
- if (String.IsNullOrEmpty(value))
- {
- throw new ArgumentNullException("First name cannot be empty!");
- }
- this.firstName = value;
- }
- }
- public string LastName
- {
- get
- {
- return this.lastName;
- }
- set
- {
- if (String.IsNullOrEmpty(value))
- {
- throw new ArgumentNullException("Last name cannot be empty!");
- }
- this.lastName = value;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement