vendredi 4 mars 2016

OOP Design: Concrete Class having different Operations with Same Base Class

I am wondering if the following code can be written in C#:

AbstractClass a = new ConcreteClass1();
a.Operations.Method1();

AbstractClass b = new ConcreteClass2();
b.Operations.Method2();

where Method1() is exclusive to the ConcreteClass1 instance and Method2() is exclusive to the ConcreteClass2() instance. As a result, a.Operations.Method2() and b.Operations.Method1() would be invalid.

Thank you!

Aucun commentaire:

Enregistrer un commentaire