From: Simon Wright <simon@pushface.org>
Subject: Re: overloading operators
Date: Wed, 21 Nov 2018 17:37:21 +0000
Date: 2018-11-21T17:37:21+00:00 [thread overview]
Message-ID: <lya7m2coxa.fsf@pushface.org> (raw)
In-Reply-To: cfb28c8d-10ce-4397-b89b-63a1a8bb98bc@googlegroups.com
hnptz@yahoo.de writes:
> On Wednesday, November 21, 2018 at 2:50:05 PM UTC+1, AdaMagica wrote:
>> Am Mittwoch, 21. November 2018 10:56:09 UTC+1 schrieb hn...@yahoo.de:
>> > How can I use the old and the overloaded operator at the same time
>> > in the same program for the same type?
>> > For example: Overloaded "*" defined by user for type Real_Matrix
>> > and "*" defined in package Numerics.Real_Arrays for Real_Matrix.
>>
>> For the nomenclature:
>> If I understand correctly what you're saying, it's not overloading,
>> but overriding what you're doing.
>> If you defined a function "*" for type Real_Matrix in a package of
>> your own, say Pack, the corresponding operation in the package where
>> Real_Matrix is defined, here Ada.Numerics, is hidden from direct and
>> use visibility in Pack. You can make it visible again via an
>> extended name.
>> So which "*" is visible at certain place depends on the kind of
>> visibility of Pack and Ada.Numerics. With proper name qualification,
>> both are callable at the same place in code.
>
> what would be a proper name qualification? Extended name for pack
> defined "*" in Ada.Numerics like pack."*"?
You can always say e.g. Ada.Numerics.Real_Arrays."*" (A, B) but it is
rather clumsy compared to A * B!
next prev parent reply other threads:[~2018-11-21 17:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-21 9:56 overloading operators hnptz
2018-11-21 11:28 ` Jeffrey R. Carter
2018-11-21 13:50 ` AdaMagica
2018-11-21 13:52 ` AdaMagica
2018-11-21 16:39 ` hnptz
2018-11-21 17:37 ` Simon Wright [this message]
2018-11-22 8:18 ` briot.emmanuel
2018-11-22 11:39 ` Simon Wright
2018-11-26 17:47 ` Anh Vo
2018-11-26 18:03 ` Simon Wright
2018-11-26 18:24 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox