PCPP-32-101 · Question #4
The following snippet represents one of the OOP pillars. Which one is that?
The correct answer is D. Polymorphism. The code snippet you provided demonstrates Polymorphism. This is because the 'run()' method is called on different objects (instances of classes A, B, and C), and each class defines its own version of the 'run()' method. This allows the same method call to behave differently…
Question
The following snippet represents one of the OOP pillars. Which one is that?
Exhibit
Options
- ASerialization
- BInheritance
- CEncapsulation
- DPolymorphism
How the community answered
(31 responses)- A6% (2)
- C3% (1)
- D90% (28)
Explanation
The code snippet you provided demonstrates Polymorphism. This is because the 'run()' method is called on different objects (instances of classes A, B, and C), and each class defines its own version of the 'run()' method. This allows the same method call to behave differently based on the object it is called on.
Topics
Community Discussion
No community discussion yet for this question.
