Thanks All for the replies.
I was of the belief a Decorator
pattern would help in this case as it provides alternative to Subclassing and relies on Composition rather than inheritance for such interchangeable behaviour.
If State pattern is applicable. Can anyone provide a high level class diagram (UML representation) of this example under study?
Or other Design pattern like Template method/Strategy would be useful?
Casting subtype to Supertype like below and subsequent deleting it is not desired.
Pilot pilotObj = new Passenger();
Please provide some code snippets.
Thanks in Advance.
Harish