HI, I'm using the protected keyword in a class to make a method accessible to
a child that inherits from it so as to be able to call the protected method
from the child class.
I can't seem to be able to access it from either the base class or the class
that inherits from it. Here is a sample of the code:
Any ideas would be most helpful.
Thanks in advance
Ant
public delegate void myDelegate(string message);
public class Person // The base class
{
// Constructor
public Person()
{
this.Deceased +=new myDelegate(Person_Deceased);
}
// Event
public event myDelegate Deceased;
// method to raise the deceased event
protected void RaiseEvent(string message)
{
this.Deceased(message);
}
// Event Handler
private void Person_Deceased(string message)
{
MessageBox.Show(message);
}
}
// class that inherits the Person class
public class Employee:Person
{
}
private void buttonClickEvent()
{
Employee emp = new Employee();
emp.RaiseEvent("Psycho"); // Get compile time inaccessible error here..
}