[Issue 17930] [Contract Programming] 23.3 In, Out and Inheritance

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 23 06:22:37 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=17930

--- Comment #2 from Rob <resmith5 at outlook.com> ---
In addition to 


class Base {

   myFunc()
   {

   }
}

class Derived : Base {
   myFunc(int a)
   in
   { 
      assert(a >= 0);
   }
   body
   {

   }
}

getting a compile error. In the following situation:

class Base2 {
   myFunc(int a)
   in 
   {
      assert(a >= 0);
   }
   body
   {

   }
}

class Derived2 : Base2 {
   myFunc(int a)
   {

   }
}

calling Derived2.myFunc is subject to the constraint in Base2.myFunc. That
behavior should probably be noted in the documentation.

--


More information about the Digitalmars-d-bugs mailing list