I have many systems, let's call them A, B, C, D, E, F, G, H, I, J
All of them have similar methods and properties. Some of them contain the same method and properties, some may vary slightly, and some may vary greatly. Right now I have a lot of duplicate code for each system. For example, I have a method called GetPropertyInformation() that is defined for each system. I'm trying to figure out which method would be the best approach to reduce duplicate code, or maybe one of the methods below is not the way to go:
Interface
public Interface ISystem { public void GetPropertyInformation();
Abstract
public abstract class System { public virtual void GetPropertyInformation() {
Virtual Methods in the Super Base Class
public class System { public virtual void GetPropertyInformation() {
One question, although it may be silly, suggests that I went with an abstract approach and I wanted to override GetPropertyInformation , but I needed to pass an additional parameter to it, is this possible or will I need to create another method in an abstract class? For example, GetPropertyInformation(x)
c # oop interface abstract-class virtual-method
Xaisoft
source share