I use inheritance quite a lot in real projects. One particular example in the old days was a framework for serialization/deserialization of objects in XML. This was implemented in both Perl and Java so that Perl objects could be serialized and deserialized as Java objects and vice versa. In both Perl and Java classes that implement this were subclasses of the 'GObject' class that had all the necessary logic.
Another example: a library for finite state machines that also implements a finite state transducer. The latter adds functionality to the former, so it inherits all from the finite state automaton, but adds code to actually output things rather than just accepting or rejecting.
Another example was a Perl wrapper around a C library that implemented connectivity to custom servers. All servers shared some functionality, but differed in the kind of requests one could do and the data they returned. Hence I had a base class implementing basic connectivity while the classes that inherited from it implemented the specific functionality.
Oh well, very useful concept... just my 2 cents, -gjb-
In reply to Re: Real live usage of inheritance?
by gjb
in thread Real live usage of inheritance?
by BUU
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |