I have a Package table in the database.
A package can be of three types: Package A, Package B and Package C.
All three packages have some common fields, for example, 1) name
2) size
3) weight
Now let's move on to the unique fields:
Packets A and B must contain -
a) a channel
Package C must contain -
a) completion
So, I create a table called "Package" in the database.
The columns of the "Package" will then be:
1) Identifier
2) type (1 = PackageA, 2 = PackageB, 3 = PackageC)
3) name
4) size
5) weight
6) channel (not required for package C)
6) completion (not required for packages A and B)
So, I am creating an abstract class as shown below (ignoring property data types):
public abstract class Package
{
public id;
public type;
public name;
public size;
public weight;
}
public class PackageA : Package
{
public channel;
}
public class PackageB : Package
{
public channel;
}
public class PackageC : Package
{
public completion;
}
what will i do wrong with this approach? Should a package class be abstract or just a class?
Since I would not want others to work directly on the package class and instead accept packages A, B, C.
EDIT: ? , / "" ( A B) ( C) "" ( C) ( A B), "null" " / ?