Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Override custom method in subclass
Message
From
08/09/2009 08:23:46
 
 
To
08/09/2009 08:07:51
General information
Forum:
ASP.NET
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
01423040
Message ID:
01423042
Views:
74
>Hi. i am coming from vfp backgroup and new in .net. i am trying to subclass a simplebutton or textbox control of .net framework and make my own class. i want to put then my own textbox /button on the form. i was able to create subclass but cant figure out few other things. lets say i have a custom method on my texbox class to activate popup dialog box if certain key is pressed. in my base textbox class, I have a code in textbox's keypress event to call this custom method.
>
>now after adding mytextbox class to my windows form, i want to be able to change something in that custom method. i.e. call base class's method first and then add few lines of my code. how can i do that?
>
>
>thanks for help in advance

Like this ?
	public class One
	{
		public void Something()
		{
			Console.WriteLine("one");
		}
	}
	public class Two : One
	{
		public new void Something() 
		{
			base.Something(); // call base class' method
			Console.WriteLine("two"); // do something else
		}
	}
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform