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 Q3to5
- {
- /*
- * Create a person Class that cannot be instatiated
- * ID, First Name, Last name as public fields
- * Has a GetInfo() method in the person class that returns a string, lastName "," firstName
- */
- public abstract partial class Person
- {
- public string ID { get; set;}
- public string firstName, lastName;
- public Person(string I, string F, string L)
- {
- ID = I; firstName =F; lastName = L;
- }
- public virtual string GetInfo()
- {
- return ID + " " + lastName + "," + firstName ;
- }
- /*
- * Create Professor Subclass, it includes "Title"
- create Staff subclass , it should include "Position"
- both include Virtual Provide GetInfo() ~ which returns string ID, name, Position (title for prof)
- For Professors a colon before Title - > eg : Title
- * */
- }
- public partial class Professor : Person
- {
- string title;
- public Professor(string I, string F, string L, string T) : base (I, F, L)
- {
- title = T;
- }
- public override string GetInfo()
- {
- return base.GetInfo() + " : " + title;
- }
- }
- public partial class Staff : Person
- {
- string position;
- public Staff(string I, string F, string L, string P) : base(I, F, L)
- {
- position = P;
- }
- public override string GetInfo()
- {
- return base.GetInfo() + " , " + position;
- }
- }
- //Create two Staff and Professor
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement