W
Wysiwyg
I'm new to c# programming and can't figure out how to avoid duplicating
common code in multiple classes when I'm restricted to using different
system base classes.. I'm using c# in asp.net to write a web application but
this isn't specifically a web question.
I have two classes which must inherit a different System class, in a
specific case my web pages must inherit System.Web.UI.Page while my user
controls must inherit System.Web.UI.UserControl. I have a significant number
of methods I want to include in both classes which are instantiated, i.e.
they can't be static, so I can't just put the code in an abstract class.
Interfaces are just a contract of methods, properties, etc. that must be
defined but they don't implement anything so that doesn't seem to help me.
So, if I have two different classes which must each be based on a different
System base class how do I share code between the two without simply
duplicating it? Note that not all of the methods are the same in the classes
I've written, just most of it.
Thanks, any help is appreciated.
Bill
common code in multiple classes when I'm restricted to using different
system base classes.. I'm using c# in asp.net to write a web application but
this isn't specifically a web question.
I have two classes which must inherit a different System class, in a
specific case my web pages must inherit System.Web.UI.Page while my user
controls must inherit System.Web.UI.UserControl. I have a significant number
of methods I want to include in both classes which are instantiated, i.e.
they can't be static, so I can't just put the code in an abstract class.
Interfaces are just a contract of methods, properties, etc. that must be
defined but they don't implement anything so that doesn't seem to help me.
So, if I have two different classes which must each be based on a different
System base class how do I share code between the two without simply
duplicating it? Note that not all of the methods are the same in the classes
I've written, just most of it.
Thanks, any help is appreciated.
Bill