With multiple alias this this should work. int getInt() const { return this.ivalue; } alias getInt this; float getFloat() const { return this.fvalue; } alias getFloat this; Or with a class method for implicit conversion.