Is this project a good idea - interfaces and abstract class

I would like to be able to do something like the following:

//non-generic
var MyTable = new Table();
string name = MyTable.Name;
IEnumerable<String> rows = MyTable.Rows;

//generic
var MyTableGeneric = new Table<MyType>();
string name = MyTableGeneric.Name;
IEnumerable<MyType> rows = MyTableGeneric .Rows;

Something like this will be a lot:

http://img81.imageshack.us/img81/427/diagramcm3.jpg

or it will be better:

http://img301.imageshack.us/img301/4136/presentation1nh9.jpg

Sorry if it's hard to understand what I'm trying to get to, basically I have two objects that will share comman properties, except that the string collections will be universal. I would like to do this in the cleanest way.

Sorry for my crappy diagrams made at powerpoint :)

+3
source share
3 answers

, . .

, , - , , .

+8

Table a Table<string>? , Table<string> ?

, Rows - , .., .

Table ? , , , , , .

+2

I would use generics in strings without involving a string in the base class and have a non-generic type of the inherited class Table. Do not use an abstract class.

Table<T> -> Table:Table<string>
+1
source

All Articles