On 3/30/21 6:28 AM, novice3 wrote:

> I want create derived type in D

"Derived type" is used in the context of object oriented programming at least in D but your examples indicate you need something else. How about the 'alias this' feature?

import std.stdio;

struct Xobj {
  void* value;
  alias value this;
}

void main() {
  int i;
  auto var = Xobj(&i);
  writeln(var);
  int j;
  var = &j;
}

alias this is for implicit conversions, from Xobj to void* in this case.

Ali

Reply via email to