From: Jere <jhb.chat@gmail.com>
Subject: Re: Using interfaces
Date: Sat, 2 Jun 2018 08:55:05 -0700 (PDT)
Date: 2018-06-02T08:55:05-07:00 [thread overview]
Message-ID: <b4b8b572-82f1-4457-bcf5-eba413df528f@googlegroups.com> (raw)
In-Reply-To: <795d1d54-0868-4745-8132-b38165494f39@googlegroups.com>
On Saturday, June 2, 2018 at 11:20:53 AM UTC-4, gautier...@hotmail.com wrote:
> Hello,
> I am developing a package for displaying some kinds of figures on an open set of devices. I'm trying to use interfaces for that.
>
> SNIPPED...
>
> this is okay but I would need to copy-paste the same implementation code of Filled_Rectangle for device X in the case of Figure_B and so on. Not nice!
>
> How do I get something like Figure_A_on_Device_X ?
> Am I expecting too much from interfaces?
>
I generally do something similar to what you do in Rust:
type Figure_A_on_Device_X is new Figure_A and Any_Device with record
Device_Impl : Device_X;
end record;
procedure Filled_Rectangle (device: Figure_A_on_Device_X);
and then
procedure Filled_Rectangle (device: Figure_A_on_Device_X) is
begin
device.Device_Impl.Filled_Rectangle;
end Filled_Rectangle;
You can also make Figure_A_on_Device_X a private type to hide that.
next prev parent reply other threads:[~2018-06-02 15:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-02 15:20 Using interfaces gautier_niouzes
2018-06-02 15:55 ` Jere [this message]
2018-06-02 17:00 ` Dmitry A. Kazakov
2018-06-02 17:22 ` Jeffrey R. Carter
2018-06-02 18:43 ` Dan'l Miller
2018-06-03 2:11 ` Shark8
2018-06-03 3:06 ` Dan'l Miller
2018-06-03 7:06 ` Dmitry A. Kazakov
2018-06-04 9:32 ` gautier_niouzes
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox