Reputation: 210
Here are my classes:
public abstract class Input
{
}
public class CreatePendingOrderInput : Input
{
public string customerNo;
public string callingCountry;
}
public class GetCustomerDetailsInput : Input
{
public string customerName;
public string customerAge;
}
I want to enforce that any class that is a child of Input
only define variables of type string
. Is this possible?
Upvotes: 0
Views: 49
Reputation: 82474
No, that's impossible. The only thing that is enforced when deriving from a base class is that the derived class has everything the base class have, except for constructors and finalizers.
Upvotes: 2