Article View: comp.sw.components
Article #45Re: Inheritance vs. component efficienc
From: Jos Warmer
Date: Thu, 24 Aug 1989 06:53
Date: Thu, 24 Aug 1989 06:53
43 lines
1586 bytes
1586 bytes
jonasn@ttds.UUCP (Jonas Nygren) writes:
>In article <130200005@p.cs.uiuc.edu> johnson@p.cs.uiuc.edu writes:
>> 2) For some reason, run-time binding is necessary.
>If C is to be considered a conventional language then there is a way to avoid
>the case-construct. Just declare a structure as follows:
> typedef struct{
> ....
> void (*display)();
> } window;
>and then the following code would achieve what Ralph wants:
> window a, b;
> a.display = draw_small_window;
> b.display = draw_big_window;
The previous two lines are just run-time binding done by hand.
> (*a.display)(a);
> (*b.display)(b);
>without case-constructs.
>It's even possible to achieve single-inheritance by adding the derived
>class's members after the base-class members in a new struct, and this
>could be semi-automated by nested include-files.
This is just inheritance done by hand.
Conclusion:
Run-time binding still seems neccesary.
OO languages offer this support automatically.
In C you can do-it-yourself, although it looks very cumbersome to me.
Jos Warmer
jos@cs.vu.nl
...uunet!mcvax!cs.vu.nl!jos
--
Technical Details
Message-ID:
<3053@vlot.cs.vu.nl>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!hp4nl!botter!star.cs.vu.nl!josReferences:
<5682@hubcap.clemson.edu> <130200005@p.cs.uiuc.edu> <1233@ttds.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!hp4nl!botter!star.cs.vu.nl!jos From: jos@cs.vu.nl (Jos Warmer) Newsgroups: comp.sw.components Subject: Re: Inheritance vs. component efficienc Message-ID: <3053@vlot.cs.vu.nl> Date: 24 Aug 89 06:53:35 GMT References: <5682@hubcap.clemson.edu> <130200005@p.cs.uiuc.edu> <1233@ttds.UUCP> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 43