I have a abstract class called Customer which has some attributes shared amongst all customers(ex id, name, surname).
Then I have few classes such as PriorityCustomers which have special unique fields such as(height, width), MidPriorityCustomers etc.
When I do this :
Customer customer = new PriorityCustomer();
I cannot access the priority customer methods. When I try it other way arround I can’t instantiate abstract class.
I’m using this because I want to process all customers trough same process only those who have special needs do something special for them.
My method is therefore returning Customer type. Am I making the wrong decision with the design here? Can anybody suggest something?
Forgot to mention :
Fields that I have in my parent abstract class I don’t have those in special customer classes and the other way arround.(no height, width in Customer class, but those are in PriorityCustomers class)
Its sounds like you have a super process method when you want specific ones.
Then all you need to is
This will allows you to process all Customer types where each Customer type knows what special processing it needs.