60.0k views
0 votes
Which is the accessor member?
1) calculate()
2) getI()
3) get()
4) setI()

User Hkurabko
by
8.2k points

1 Answer

2 votes

Final answer:

The accessor member is likely to be option 3, get(), which implies getting the value of a property and follows the typical naming convention of accessor methods in object-oriented programming. GetI() could also be an accessor, but get() is more common as a general-purpose accessor method.

Step-by-step explanation:

The accessor member in object-oriented programming is a method used to read data from an object's internal state. Among the options provided, getI() and get() follow the naming convention typically used for accessor methods, which usually start with 'get' followed by the name of the property being accessed.

However, without additional context, it is most common to see methods named simply get as general-purpose accessor methods if they are generic or if the context is obvious from the object itself. Therefore, option 3, get(), is the most likely to be the accessor member as it implies getting the value of a property. On the other hand, setI() would be considered a mutator or a setter, as it suggests it is used to set or update the value of a property.

User Bladekp
by
8.8k points