From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-12 13:11:43 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: hyrosen@mail.com (Hyman Rosen) Newsgroups: comp.lang.ada Subject: Re: Is the Writing on the Wall for Ada? Date: 12 Sep 2003 13:11:40 -0700 Organization: http://groups.google.com/ Message-ID: <568ede3c.0309121211.743a8da2@posting.google.com> References: <3F615341.4000100@attbi.com> NNTP-Posting-Host: 204.253.248.214 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1063397503 31813 127.0.0.1 (12 Sep 2003 20:11:43 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 12 Sep 2003 20:11:43 GMT Xref: archiver1.google.com comp.lang.ada:42430 Date: 2003-09-12T20:11:43+00:00 List-Id: "Robert I. Eachus" wrote in message news:<3F615341.4000100@attbi.com>... > There is no way to directly inherit from two > classes, unless one is a subclass of the other. I am well an truly puzzled at this remark. Let me give a C++ example, and you can tell me why you don't believe it. struct Colorable { virtual void setColor(int color) = 0; virtual int getColor() = 0; virtual ~Colorable() { } }; struct ColorableAdapter : virtual Colorable { void setColor(int color) { m_color = color; } int getColor() { return m_color; } ColorableAdapter(int color = 0) : m_color(color) { } private: int m_color; }; struct Resizable { virtual void setSize(double size) = 0; virtual double getSize() = 0; virtual ~Resizable() { } }; struct ResizableAdapter : virtual Resizable { void setSize(double size) { m_size = size; } double getSize() { return m_size; } ResizableAdapter(double size = 1) : m_size(size) { } private: double m_size; }; struct MyObject : ColorableAdapter, ResizableAdapter { MyObject(int color = 0, double size = 1) : ColorableAdapter(color), ResizableAdapter(size) { } void doSomething(); };