|
|
Warp <war### [at] tagpovrayorg> wrote:
> Maybe not completely related, but I find it curious how some
> object-oriented concepts talk about inheritance about one class/object
> extending another, while others talk about specializing, although they
> are technically speaking usually the same thing.
As these terms are commonly used, yes. It can be defined more strictly though,
to show the differences:
"Extending" can be defined as *adding* to an interface, where "specializing" can
be defined as *modifying* the implementation of an interface.
Both are an example of polymorphism; however, only the former requires runtime
type checking, while only the latter requires runtime method lookup.
So they are in fact orthogonal, and any sane OO language supports both -
although they often use either of the two terms in the broader synonymous
sense.
I like C# in this respect, as it requires you to be clear about which methods
you add (= extending) and which you override (= specializing). If that doesn't
match up with the base class, C# will force you to stop and rethink about it.
Post a reply to this message
|
|