|
Posted by Malcolm Dew-Jones on 08/27/05 08:09
Jerry Stuckle (jstucklex@attglobal.net) wrote:
: Tony Marston wrote:
: > "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
: > news:UKedncCCMIZIp5PeRVn-3A@comcast.com...
: >
: >>Kenneth Downs wrote:
: >
: > <snip>
: >
: >>As to "Anything possible in OO can be done without it". How do you do
: >>inheritance and polymorphism in non-OO code? I'd love to see an example
: >>of that. And as above - how do you ensure encapsulation?
: >
: >
: > I used a non-OO language called UNIFACE in which I achieved encapsulation
: > and polymorphism. There was a sort of inheritance, but that was only one
: > level deep when a component was built from a template. You could change code
: > in the template, and that change would be inherited by all components based
: > on that template the next time they were recompiled.
: >
: Not familiar with UNIFACE - but it sounds like it had some rudimentary OO
: constructs in it - at least inheritance and polymorphism.
: But can you do it in a pure non-OO language such as C, Basic, PASCAL or others
: (I'm not talking about OBJECT - xxx).
It's easy to write oo stuff using pure C, Heck, the first versions of C++
were apparently just C with carefully crafted preprocessing macros, and
the first template stuff was handled by preprocessing too. Long before
anyone talked about oo my Atari ST compiler had examples of window
handling that was code designed along the same conceptual lines as oo (at
least long before I ever head of it, anyway). Just build a common
structure that includes a standared way to incldue the function pointers
necessary for handling that type of structure. Add a lookup function to
find the functions and the whole thing becomes dynamic to boot (I thinks
that's how objective C [used to] works).
Having it natively in the language just makes it (much) easier to use, and
more (easily) flexible, etc etc.
--
This programmer available for rent.
[Back to original message]
|