Hi
I'm extending some .NET classes. The classes are ASP controls, textbox, dropdownlist, etc.
The above classes are all extended with exactly the same properties. Therefore it makes sense to abstract those properties to the base class. This will then allow me to conver to to and from that base class with my new properties. There's also the advantage of less source code overhead.
My probelm is then, how do you extend the base class of a set of classes so that those extension are automatically propagated to all the child classes? Can this be done with C# .NET ASP 3.5?
c# inheritance probelm anyone?
-
- Registered User
- Posts: 26
- Joined: 01 Jun 2008, 02:00
- Ron2K
- Forum Technical Administrator
- Posts: 9050
- Joined: 04 Jul 2006, 16:45
- Location: Upper Hutt, New Zealand
- Contact:
Basically:
If you do not intend to create instances of your base class and thus will only use it for abstraction purposes, specify the "abstract" keyword in the class definition.
Code: Select all
public class BaseClass
{
// class implementation goes here
}
public class ChildClass : BaseClass
{
// class implementation goes here
}
Kia kaha, Kia māia, Kia manawanui.