Connecting Tech Pros Worldwide Forums | Help | Site Map

Visual Inheritance - Overriding Methods

Vijay
Guest
 
Posts: n/a
#1: Nov 17 '05
hi all,
This is a C# Application.
I just use visual Inheritance to derive a base form, Now I override the
button click event of the base class control in the derived class.
Class A
{
protected virtual void Cmd_Base_Click(object sender, System.EventArgs e)
{
MessageBox.Show("Base");
}
}

Class B : Class A
{
protected override void Cmd_Base_Click(object sender, System.EventArgs e)
{
MessageBox.Show("Derived");
}
}

- When I run the Application and Click the Base Class Button. Msg Box
"Derived" is thrown twice. Why is it? Since the Click event method is
overridden, It has to be called once?
Help required.

Closed Thread