Re: implimenting interface function by inheriting from other class

2021-08-22 Thread Alexey via Digitalmars-d-learn
On Sunday, 22 August 2021 at 12:20:56 UTC, Alexey wrote: On Saturday, 21 August 2021 at 20:35:43 UTC, Alexey wrote: Hello ```D interface Int { void coolFunc(); } class C1 { void coolFunc() { return; } } class C2 : C1, Int { } void main() { auto c = new C2; } ```

Re: implimenting interface function by inheriting from other class

2021-08-22 Thread Alexey via Digitalmars-d-learn
On Saturday, 21 August 2021 at 20:35:43 UTC, Alexey wrote: Hello ```D interface Int { void coolFunc(); } class C1 { void coolFunc() { return; } } class C2 : C1, Int { } void main() { auto c = new C2; } ``` dmd says it's not Ok: t.d(14): Error: class `t.C2`

Re: implimenting interface function by inheriting from other class

2021-08-21 Thread Tejas via Digitalmars-d-learn
On Sunday, 22 August 2021 at 01:14:08 UTC, Alexey wrote: On Saturday, 21 August 2021 at 20:35:43 UTC, Alexey wrote: Hello ```D interface Int { void coolFunc(); } class C1 { void coolFunc() { return; } } class C2 : C1, Int { } void main() { auto c = new C2; } ```

Re: implimenting interface function by inheriting from other class

2021-08-21 Thread Alexey via Digitalmars-d-learn
On Saturday, 21 August 2021 at 20:35:43 UTC, Alexey wrote: Hello ```D interface Int { void coolFunc(); } class C1 { void coolFunc() { return; } } class C2 : C1, Int { } void main() { auto c = new C2; } ``` dmd says it's not Ok: t.d(14): Error: class `t.C2`

Re: implimenting interface function by inheriting from other class

2021-08-21 Thread Alexey via Digitalmars-d-learn
On Saturday, 21 August 2021 at 23:14:14 UTC, Alexey wrote: I want `this` inside of C1::coolFunc to return C2 if called as C2::coolFunc so executing `cast(C2) this !is null` inside of C1::coolFunc would work If this would work, I'd farther used this like so ```D interface Int { void

Re: implimenting interface function by inheriting from other class

2021-08-21 Thread Alexey via Digitalmars-d-learn
I want `this` inside of C1::coolFunc to return C2 if called as C2::coolFunc so executing `cast(C2) this !is null` inside of C1::coolFunc would work

Re: implimenting interface function by inheriting from other class

2021-08-21 Thread Alexey via Digitalmars-d-learn
On Saturday, 21 August 2021 at 22:56:40 UTC, Bastiaan Veelo wrote: On Saturday, 21 August 2021 at 20:35:43 UTC, Alexey wrote: Hello ```D interface Int { void coolFunc(); } class C1 { void coolFunc() { return; } } class C2 : C1, Int { } void main() { auto c = new

Re: implimenting interface function by inheriting from other class

2021-08-21 Thread Bastiaan Veelo via Digitalmars-d-learn
On Saturday, 21 August 2021 at 20:35:43 UTC, Alexey wrote: Hello ```D interface Int { void coolFunc(); } class C1 { void coolFunc() { return; } } class C2 : C1, Int { } void main() { auto c = new C2; } ``` dmd says it's not Ok: t.d(14): Error: class `t.C2`

implimenting interface function by inheriting from other class

2021-08-21 Thread Alexey via Digitalmars-d-learn
Hello ```D interface Int { void coolFunc(); } class C1 { void coolFunc() { return; } } class C2 : C1, Int { } void main() { auto c = new C2; } ``` dmd says it's not Ok: t.d(14): Error: class `t.C2` interface function `void coolFunc()` is not implemented how to