A
Action
does it works like ordinary virtual method??
coz I find that child class can't invoke the event of the parent class.
class parent
{
public virtual event SomeDelegate SomeChanged;
}
class child : parent
{
void abc()
{
this.SomeChanged+=SomeMethod; // ok
if (this.SomeChanged != null) // can't
this.SomeChanged(); // can't
}
}
class parent
{
public virtual event SomeDelegate SomeChanged;
}
class child : parent
{
public override event SomeDelegate SomeChanged; // what's the use of
overriding a parent event?
}
void main()
{
parent childInstance = new childInstance;
childInstance.SomeChanged+=SomeMethod; // it's parent's one or child's
one?
}
coz I find that child class can't invoke the event of the parent class.
class parent
{
public virtual event SomeDelegate SomeChanged;
}
class child : parent
{
void abc()
{
this.SomeChanged+=SomeMethod; // ok
if (this.SomeChanged != null) // can't
this.SomeChanged(); // can't
}
}
class parent
{
public virtual event SomeDelegate SomeChanged;
}
class child : parent
{
public override event SomeDelegate SomeChanged; // what's the use of
overriding a parent event?
}
void main()
{
parent childInstance = new childInstance;
childInstance.SomeChanged+=SomeMethod; // it's parent's one or child's
one?
}