Subclass of Exception

Paul via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 14 04:59:52 PDT 2014


One stupid question: in Python subclassing of Exception looks 
like:
   class MyError(Exception): pass
but in D, if I'm right, we should write more code:
   class MyError : Exception {
     this(string msg) { super(msg); }
   }
(without constructor we get error: "...Cannot implicitly generate 
a default ctor when base class <BASECLASS> is missing a default 
ctor...")

Is any shorter D way?


More information about the Digitalmars-d-learn mailing list