How do you pass parameters to the constructor when creating an anonymous class in D -


i how create anonymous class

class {}  class b {     anonymous = new class { ... }; } 

but if has constructor, , no default constructor.

class {     init(string somearg) {     } }  class b {     anonymous = new class { ... };??? } 

how pass parameter constructor?

just implement default constructor calls parent constructor super:

class {     this(string somearg) {} }  void main() {     anonyomus = new class {         this()         {             super("hello");         }     }; } 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -