IPA FE Subject A 2025 Question 12
A question IPA Japan published in 令和7年度 基本情報技術者試験 科目A 公開問題 問12, translated into English. ITPEC is based on the same exams.
Among the characteristics of object-oriented programming, what is the term for enabling different behaviors according to the class being operated on, when objects of different classes are operated through the same interface?
Explanation
Polymorphism — the same operation, called through the same interface, produces behaviour that depends on the class of the object that receives it.
Example: classes Circle and Square both implement draw( of an interface Shape. Code that calls draw( on every element of a list of shapes needs no check of their classes: each object runs its own version and draws a circle or a square. Polymorphism is usually achieved by overriding a superclass method or implementing an interface, and it lets new classes be added without changing the calling code.
Answer (d)
Why not others:
- •(a) Delegation — an object hands a request it receives over to another object, which does the actual processing
- •(b) Inheritance — a subclass takes over the attributes and methods of its superclass; it is a common basis for polymorphism, but not the property itself
- •(c) Composition — an object is built by holding other objects as its parts (a has-a relationship)
Key rule: Polymorphism is one interface with behaviour chosen by the receiving object's class; inheritance reuses a superclass, delegation forwards work to another object, composition builds a whole from parts.
System Development Technology · AI-written, may contain errors
This question comes from the past questions IPA Japan publishes, translated into English by ITPEC Practice. ITPEC Practice is an independent study tool and is not affiliated with IPA or ITPEC. See the original paper (PDF) or Report an issue.