Ideally, you need an explicit casting which check a particular observer is of type Student or Staff. In such case, you can generalize your notification method as below instead of writing two notification methods.
public void Notify()
{
foreach (IPerson o in observers)
{
if (IPerson is Student)
o.Update(QuestionNumber);// Student - question number
else
o.Update(Factor);//Staff - feel-good factor
}
}
As per the request on how inheritance works in this case;
public abstract class Person : IPerson
{
private string id;
public Person(){}
public Person(string i)
{
id = i;
}
public abstract void Update(Object o);
}
public class Student:Person
{
public Student(){}
public Student(string i):base(i)
{
}
public override void Update(object o)
{
//whatever you wanted to do with Student
}
}
public class Staff : Person
{
public Staff(){}
public Staff(string i)
: base(i)
{
}
public override void Update(object o)
{
//whatever you wanted to do with Staff
}
}
interface IPerson //Observer interface
{
void Update(Object o);
}