View mode: basic / threaded / horizontal-split · Log in · Help
July 24, 2009
[Issue 3206] New: Cannot instantiate a class implementing an abstract method
http://d.puremagic.com/issues/show_bug.cgi?id=3206

          Summary: Cannot instantiate a class implementing an abstract
                   method
          Product: D
          Version: 2.031
         Platform: Other
       OS/Version: Windows
           Status: NEW
         Keywords: rejects-valid
         Severity: normal
         Priority: P2
        Component: DMD
       AssignedTo: nobody@puremagic.com
       ReportedBy: samukha@voliacable.com


abstract class A
{
   abstract void foo();
}

class B : A
{
   void bar(B b = new B)
   {
   }

   void foo()
   {
   }
}

void main()
{
   auto a = new B;
}
----
test.d(19): Error: cannot create instance of abstract class B
test.d(19): Error: function foo is abstract

The bug can be worked around by placing 'foo' before 'bar':

class B : A
{
   void foo()
   {
   }

   void bar(B b = new B)
   {
   }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home