M
Morten Wennevik
Hi Tamir,
You can use Interfaces for what you describe.
Define an interface for the common properties/methods and have each class implement that interface.
class ClassA : IMyInterface
{
}
....
Then you can do
IMyInterface m = new ClassA();
IMyInterface m = new ClassB();
The implementation in ClassA and ClassB can be as different as they like, but you can pass objects of both ClassA and ClassB to any method that expects an IMyInterface object.
You can use Interfaces for what you describe.
Define an interface for the common properties/methods and have each class implement that interface.
class ClassA : IMyInterface
{
}
....
Then you can do
IMyInterface m = new ClassA();
IMyInterface m = new ClassB();
The implementation in ClassA and ClassB can be as different as they like, but you can pass objects of both ClassA and ClassB to any method that expects an IMyInterface object.