Re: parent class get the subclass object

2017-01-16 Thread Brian via Digitalmars-d
On Monday, 16 January 2017 at 16:47:09 UTC, Nemanja Boric wrote: On Monday, 16 January 2017 at 16:31:41 UTC, Brian wrote: [...] You're missing a cast, since `this` is a reference to a superclass. import std.stdio : writeln; abstract class Base(T) { this() { _this =

Re: parent class get the subclass object

2017-01-16 Thread Brian via Digitalmars-d
On Monday, 16 January 2017 at 19:31:50 UTC, Mike Parker wrote: On Monday, 16 January 2017 at 16:31:41 UTC, Brian wrote: No, you don't understand I want to express meaning. other programing language is allow this. Your code more like the old C++. If a high-level programing language or need

Re: parent class get the subclass object

2017-01-16 Thread Dsby via Digitalmars-d
On Monday, 16 January 2017 at 19:31:50 UTC, Mike Parker wrote: On Monday, 16 January 2017 at 16:31:41 UTC, Brian wrote: No, you don't understand I want to express meaning. other programing language is allow this. Your code more like the old C++. If a high-level programing language or need

Re: parent class get the subclass object

2017-01-16 Thread Mike Parker via Digitalmars-d
On Monday, 16 January 2017 at 16:31:41 UTC, Brian wrote: No, you don't understand I want to express meaning. other programing language is allow this. Your code more like the old C++. If a high-level programing language or need haevy like C++ impl code, It's very regret. Can like rust /

Re: parent class get the subclass object

2017-01-16 Thread Nemanja Boric via Digitalmars-d
On Monday, 16 January 2017 at 16:31:41 UTC, Brian wrote: On Monday, 16 January 2017 at 12:20:47 UTC, rikki cattermole wrote: On 17/01/2017 1:15 AM, Brian wrote: Dlang should support such coding. What should I do? import std.stdio : writeln; abstract class Base(T) { this() {

Re: parent class get the subclass object

2017-01-16 Thread Brian via Digitalmars-d
On Monday, 16 January 2017 at 12:20:47 UTC, rikki cattermole wrote: On 17/01/2017 1:15 AM, Brian wrote: Dlang should support such coding. What should I do? import std.stdio : writeln; abstract class Base(T) { this() { _this = this; } void hello() {

Re: parent class get the subclass object

2017-01-16 Thread rikki cattermole via Digitalmars-d
On 17/01/2017 1:15 AM, Brian wrote: Dlang should support such coding. What should I do? import std.stdio : writeln; abstract class Base(T) { this() { _this = this; } void hello() { _this.world(); } private { T _this; } } class Sub

parent class get the subclass object

2017-01-16 Thread Brian via Digitalmars-d
Dlang should support such coding. What should I do? import std.stdio : writeln; abstract class Base(T) { this() { _this = this; } void hello() { _this.world(); } private { T _this; } } class Sub : Base!Sub { void world() {