Issue with 2.071: Regression or valid error?

Daniel Kozak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 6 12:22:44 PDT 2016


This should not compile. Cat cant access create because it is private. Ok
it can access it but only if you move cat into same module as animal
Dne 6. 4. 2016 17:16 napsal uživatel "Andre via Digitalmars-d-learn" <
digitalmars-d-learn at puremagic.com>:

> Hi,
>
> With 2.071 following coding does not compile anymore and somehow I feel it
> should compile.
> The issue is with line "cat.create();".
> Cat is a sub type of Animal. Animal "owns" method create and I want to
> call the method
> create within the class Animal for cat.
>
> Is the error message "no property create for type 'b.cat'" valid or not?
>
> Kind regards
> André
>
> module a;
> import b;
>
> class Animal
> {
>         private void create() {}
>
>         void foo(Cat cat)
>         {
>                 cat.create(); // >> no property create for type 'b.cat'
>         }
> }
>
> void main() {}
>
> --------------
>
> module b;
> import a;
>
> class Cat: Animal {};
>
> compile with
>
>> rdmd a b
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20160406/9fd4e019/attachment.html>


More information about the Digitalmars-d-learn mailing list