>>108813229
An object may inherit or re-implement setters and getters. Here a small example in pseudo code
Interface Rectangle:
getX(x)
setX(x)
getY(y)
setY(y)
getArea()
class RectangleLazy implements Rectangle:
int x
int y
setX(x):
this.x = x
getX()
return this.x
setY(y):
this.y = y
getY()
return this.y
getArea()
return this.x * this.y
class RectangleCached inherits RectangleLazy
int area
cacheArea():
this.area = this.x * this.y
setX(x):
this.x = x
cacheArea()
setY(y):
this.y = y
cacheArea()
getArea():
return this.area