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

2020-02-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/6/20 10:11 AM, Steven Schveighoffer wrote b.step(); // virtual call, calls B.step I meant, calls A.step; -Steve

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

2020-02-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/6/20 8:05 AM, Mihail Lorenko wrote: On Thursday, 6 February 2020 at 12:37:01 UTC, Adam D. Ruppe wrote: On Thursday, 6 February 2020 at 12:15:17 UTC, Mihail Lorenko wrote:     B* b; A pointer to a class is a rare thing in B since they are already automatic references. Just use `B b;` and

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

2020-02-06 Thread Mihail Lorenko via Digitalmars-d-learn
On Thursday, 6 February 2020 at 12:37:01 UTC, Adam D. Ruppe wrote: On Thursday, 6 February 2020 at 12:15:17 UTC, Mihail Lorenko wrote: B* b; A pointer to a class is a rare thing in B since they are already automatic references. Just use `B b;` and ten `b = a` will just work. Thanks for

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

2020-02-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 6 February 2020 at 12:15:17 UTC, Mihail Lorenko wrote: B* b; A pointer to a class is a rare thing in B since they are already automatic references. Just use `B b;` and ten `b = a` will just work.

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

2020-02-06 Thread Mihail Lorenko via Digitalmars-d-learn
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 over