I have a exceptionBase class for application level exception and one data tire base
class.Now I want to create a class which will inherit both the above base classes.
How can I approach thsi
I am using abstract base classes...
Please suggets me some guide lines.....
regards
ashok

Inheritance Issue!!!!!
Jan Pukovec
It's not possible to inherit from both classes. Most .NET languages do not support multiple inheritance.
What you can do is extract one of the classes out into a interface and inherit that interface.
I have posted a blog entry regarding this:
http://davidkean.net/archive/2005/01/02/216.aspx
Sinem
Hello Ashok,
As David told you, Microsoft .NET Framework Common Language Infrastructure (CLI) Standards Specifications -also known as Common Language Specification (CLS)- indicate that any CLS compliant language (any .NET language) must NOT support multiple inheritance. You cannot inherit more than 1 class, however, you can "implement" any number of interfaces you might want.
For more information and to review the specs., check Microsoft ..NET Framework Common Langauge Runtime (CLR) section at MSDN .NET Framework Developer Center. Also, read Brad Abrams blog post on the .NET CLS.
As a good practice, I'd advise you to replace your abstract classes with interfaces. Not only in this particular case, but, most of the time, so that the classes can explicitly implement these interfaces even if each of them is inherited from another class. Use abstract class as a base whenever you do NOT want the class that implements your abstract members (inherits your abstract class) to be a child of any other class (inherit another class).
I hope that you do like that behavior.
Most regards,
Chartsiam
Do you mean to ask if interfaces support properties Yes, interfaces support properties and even events. For example:
public interface IMyInterface {
string MyProperty;
}
public class MyClass : IMyInterface {
public string MyProperty {
get { ... }
set { ... }
}
}
digimonk
Well if I was you, I would use Interfaces and not classes. You can inherit from both at the same time.
thargy
Example:
class Control
{
}
interface ISerializable
{
}
interface IDataBound
{
}
class MyGrid : Control, ISerializable, IDataBound
{
}
You can aggregate the behavorial characterisitcs of multiple programmatic entities by implementing multiple interfaces.
tp_hi
No sorry I wasn't clear...in Dave's post: http://davidkean.net/archive/2005/01/02/216.aspx he shows how to define an AddOnClass and then call it's method, I wanted to know how this could be achieved for properties (if at all possible).
public class MyMultiConcrete : MyBaseClass, IAddOnClass
{
private AddOnClass _AddOnClass;
public MyMultiConcrete()
{
_AddOnClass = new AddOnClass();
}
public void MyAddOnMethod()
{
_AddOnClass.MyAddOnMethod();
}
}
Matt W.