Last active
December 19, 2017 08:44
-
-
Save maritaria/40f4f70d78f59cafa6364bdde90c81ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Patient | |
{ | |
protected string Name; | |
protected MedicalRecords MedicalRecords; | |
protected List<Surgery> ScheduledSurgeries; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PatientForSurgeon : Patient | |
{ | |
public string GetName() { | |
return base.Name; | |
} | |
public MedicalRecords GetRecords() { | |
return base.MedicalRecords; | |
} | |
} | |
public class PatientForDeskWorker : Patient { | |
public string GetName() { | |
return base.Name; | |
} | |
public Surgery[] GetScheduledSurgeries() { | |
return base.ScheduledSurgeries.ToArray(); | |
} | |
public void ScheduleSurgery(Surgery s) { | |
base.ScheduledSurgeries.Add(s); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Patient | |
{ | |
private string Name; | |
private MedicalRecords MedicalRecords; | |
private List<Surgery> ScheduledSurgeries; | |
public MedicalRecords GetRecords() { | |
return this.MedicalRecords; | |
} | |
public string GetName() { | |
return this.Name; | |
} | |
public Surgery[] GetScheduledSurgeries() { | |
return this.ScheduledSurgeries.ToArray(); | |
} | |
public void ScheduleSurgery(Surgery s) { | |
this.ScheduledSurgeries.Add(s); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Patient | |
{ | |
protected string Name; | |
protected MedicalRecords MedicalRecords; | |
protected List<Surgery> ScheduledSurgeries; | |
public MedicalRecords GetRecords() { | |
if (Context.View != "Surgeon") throw new ViewException(); | |
return this.MedicalRecords; | |
} | |
public string GetName() { | |
return this.Name; | |
} | |
public Surgery[] GetScheduledSurgeries() { | |
if (Context.View != "DeskWorker") throw new ViewException(); | |
return this.ScheduledSurgeries.ToArray(); | |
} | |
public void ScheduleSurgery(Surgery s) { | |
if (Context.View != "DeskWorker") throw new ViewException(); | |
this.ScheduledSurgeries.Add(s); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment