ITPEC FE Morning April 2019 Question 48
Which of the following can generally be called a subclass of an “automobile” based on the concept of object orientation?
Explanation
Truck — a subclass must pass the "is a" test with its superclass, and a truck is an automobile.
A subclass is a more specific kind of the superclass: it inherits every attribute and operation of the automobile and adds its own, such as a load capacity. Parts of an automobile and data about it do not pass the test: an engine is not an automobile, it is something an automobile has.
Answer (d)
Why not others:
- •(a) Engine — a part of an automobile, a "has a" relation modelled as aggregation or composition
- •(b) Manufacturing number — an attribute of an automobile, a data item inside the class, not a class of its own
- •(c) Tire — another part of an automobile, again "has a", not "is a"
Key rule: If "X is a Y" reads true, X can be a subclass of Y; if "Y has an X" reads true, X is a part or an attribute.
System Development Technology · AI-written, may contain errors
This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.