So my question is not WHAT IS POLYMORPHISM? I know what the defnition of Polymorphism is
But how to answer the question in a phone interview when the interviewer says,
Were and how did you achieve polymorphism? How to answer that question without stumbling?
Can someone give me a and explicit answer as how you would answer this in an interview and apply it to the STAR method approach below?
S- Situation (While working for company X.........)
T-Task (For this particular task I was responsible for......)
A-Action (The actions I took.......)
R-Result (The system implemented as team ........)

Sujeet SumanRank #790 · 2.9K reputationPosted Sep 20, 2015, 9:06 PM EDT
Sujeet SumanRank #790 · 2.9K reputationPosted Sep 18, 2015, 9:35 PM EDT
David SmithRank #999 · 2K reputationPosted Sep 19, 2015, 3:26 AM EDT
public abstract class Vehicle { public abstract int Wheels; } public class Bicycle : Vehicle { public override int Wheels() { return 2; } } public class Car : Vehicle { public override int Wheels() { return 4; } } public class Truck : Vehicle { public override int Wheels() { return 18; } } S- Situation (While working for company X.........) T-Task (For this particular task I was responsible for......) A-Action (The actions I took.......) R-Result (The system implemented as team ........)Sujeet SumanRank #790 · 2.9K reputationPosted Sep 19, 2015, 5:46 AM EDT
S- Situation: (You are working for TATA MOTOR company as a sofrware Engineer.) T-Task: (You have to develop a software to maintain their manufacturing material data for different type of vehicle like Bicycle, Car Truck etc.) A-Action: (So now in software designing phase you have to define a class structure for different type of vehicle. So here you have seen that your requirement is to define classes for different type of vehicle first. So you defined 3 different classes Bicycle, Car & Truck. So now you should think that all vehicle having some common type of uses like tyres, engine, side mirror etc. & you have to maintain their specifications. IN DESIGNING PHASE WE ARE NOT DOING CODING ONLY DESIGNING A MODEL. So now you should create abstract class to keep commonly implemented / uses method like Wheels & inherit the abstract class by all different classes. So here you will see that all derived classes must be implement those abstract methods. R-Result: (Then you should start implementation of design i.e. coding. So as a team you can work on & in this way your software will be developed.)David SmithRank #999 · 2K reputationPosted Sep 20, 2015, 12:01 AM EDT
S- Situation: I'm glad you ask. A relevant example being at my last company TATA MOTOR where I collaborated with mainframe developers to produce a new vehicle module for our Transportation WPF Product using the MVVM architectural pattern. T-Task: My task was to design and develop software to maintain their manufacturing material data for different types of Vehicle like Bicycle, Car, Truck etc.... A-Action: In the software designing phase after soliciting requirements from stakeholders I define and create an abstract polymorphism pattern. I created an abstract vehicle class for types of vehicle. By creating an abstract vehicle class I force all sub vehicle derived classes to implement the common abstract methods. R-Result: In the end I produced a successful loose-couple, extensible, and testable module for our transportation module. The stakeholders were pleased with the product.Sujeet SumanRank #790 · 2.9K reputationPosted Sep 20, 2015, 5:38 AM EDT
David SmithRank #999 · 2K reputationPosted Sep 20, 2015, 11:41 AM EDT
David SmithRank #999 · 2K reputationPosted Sep 20, 2015, 11:41 AM EDT
David SmithRank #999 · 2K reputationPosted Sep 20, 2015, 11:41 AM EDT
Suthish NairRank #92 · 22.8K reputationPosted Sep 20, 2015, 10:29 PM EDT
discussing the specific situation, task, action, and result of the situation you are describing.
David SmithRank #999 · 2K reputationPosted Sep 20, 2015, 11:02 PM EDT
public abstract class Vehicle { public abstract int Wheels; } public class Bicycle : Vehicle { public override int Wheels() { return 2; } } public class Car : Vehicle { public override int Wheels() { return 4; } } public class Truck : Vehicle { public override int Wheels() { return 18;Sujeet SumanRank #790 · 2.9K reputationPosted Sep 20, 2015, 11:14 PM EDT
S- Situation: (You are working for TATA MOTOR company as a sofrware Engineer.) T-Task: (You have to develop a software to maintain their manufacturing material data for different type of vehicle like Bicycle, Car Truck etc.) A-Action: (So now in software designing phase you have to define a class structure for different type of vehicle. So here you have seen that your requirement is to define classes for different type of vehicle first. So you defined 3 different classes Bicycle, Car & Truck. So now you should think that all vehicle having some common type of uses like tyres, engine, side mirror etc. & you have to maintain their specifications. IN DESIGNING PHASE WE ARE NOT DOING CODING ONLY DESIGNING A MODEL. So now you should create abstract class to keep commonly implemented / uses method like Wheels & inherit the abstract class by all different classes. So here you will see that all derived classes must be implement those abstract methods. R-Result: (Then you should start implementation of design i.e. coding. So as a team you can work on & in this way your software will be developed.)David SmithRank #999 · 2K reputationPosted Sep 20, 2015, 11:40 PM EDT
S- Situation: I'm glad you ask. A relevant example being at my last company TATA MOTOR where I collaborated with mainframe developers to produce a new vehicle module for our Transportation WPF Product using the MVVM architectural pattern. T-Task: My task was to design and develop software to maintain their manufacturing material data for different types of Vehicle like Bicycle, Car, Truck etc.... A-Action: In the software designing phase after soliciting requirements from stakeholders I define and create an abstract polymorphism pattern. I created an abstract vehicle class for types of vehicle, to reuse the common behavior that can be use from the derived types of vehicle class.. By creating an abstract vehicle class I force all sub vehicle derived classes to implement the common abstract methods. R-Result: In the end I produced a successful loose-couple, extensible, and testable module for our transportation module. The stakeholders were pleased with the product.Sujeet SumanRank #790 · 2.9K reputationPosted Sep 20, 2015, 11:50 PM EDT
David SmithRank #999 · 2K reputationPosted Sep 20, 2015, 11:53 PM EDT
A-Action: In the software designing phase after soliciting requirements from stakeholders I define and create an abstract polymorphism pattern. I created an abstract vehicle class for types of vehicle, to reuse the common behavior that can be use from the derived types of vehicle class.. By creating an abstract vehicle class I force all sub vehicle derived classes to implement the common abstract methods.