Object "A" inherited object "B". And you need to return the object link "B".

Mihail Lorenko miha.uva at ya.ru
Thu Feb 6 12:15:17 UTC 2020


Hello!
Interested in a question.
Object "A" inherited object "B". And you need to return the 
object link "B". Is this possible in this language? Here is an 
example:

>class B
>{
>    protected int a;
>    public void step() {};
>}
>
>class A : B
>{
>    public override step()
>    {
>        import std.random;
>        a = uniform(5,100);
>    }
>}
>
>void main()
>{
>     B* b;
>     A  a;
>     a.step();
>     b = a.B; // @FixMe: Here you need a link to object B from 
> object A.
>}

Sorry to trouble you, thanks in advance!


More information about the Digitalmars-d-learn mailing list