Interface Method 1 to keep and 1 to override...
Posted on 2011-09-22
Hello, I have a data connection wrapper I'm building to allow programs to act as the data source for another.
Here is the issue. I have an interface, "IDataEngine", and in it, it has 2 methods. (more, but it only needs 2 for this example of it)
The Methods are,
public DataSet QuerySet(string sql); // inheriting classes should need to override this;
public DataTable QueryTable(string sql) // inheriting classes should not need to override this.
// does error checking but is essentially,
Clearly, I do not need EVERY inheriting app to rewrite the same code for QueryTable, since it will be the same EVERY time.
But so far, every time I tell a class to implement the IDataEngine interface, it overrides the methods that have code as well as the ones without.
How do I change this, so overriding classes do not need to rewrite methods that are already functional on an interface? Thanks.