consider i have a Customer Class and it got CustomerTypeA, CustomerTypeB, CustomerTypeC as child classes.
Would it be a better design to implement a ICustomer interface to Customer class and create sub type objects (CustomerTypeA, CustomerTypeB, CustomerTypeC)
interface ICustomer {}
class Customer : ICustomer {}
class CustomerTypeA : ICustomer {}
class CustomerTypeB : ICustomer {}
class CustomerTypeC : ICustomer {}
ICustomer obj;
obj = new CustomerTypeB();
or
Create objects of child classes with Customer class object declaration?
class Customer {}
class CustomerTypeA : Customer {}
class CustomerTypeB : Customer {}
class CustomerTypeC : Customer {}
Customer obj;
obj = new CustomerTypeB();
How should i choose which approach to follow?
May be in other words, is it a better design that every parent object to implement from an Interface? what advantage does it bring me?
Thank you