I’m trying to learn interfaces and want to try the following:
Let’s say I have an interface named ICustomer that defines basic properties (UserID, UserName, etc). Now, I have multiple concrete classes like ProductA_User, ProductB_User, ProductC_User. Each one has different properties but they all implement ICustomer as they are all customers.
I want to invoke a shared method in a factory class named MemberFactory and tell it to new me up a user and I just give it a param of the enum value of which one I want. Since each concrete class is different but implements ICustomer, I should be able to return an instance that implements ICustomer. However, I’m not exactly sure how to do it in the factory class as my return type is ICustomer.
All you have to do is create your object like this: