[Issue 3206] New: Cannot instantiate a class implementing an abstract method

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 24 00:39:46 PDT 2009


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 at puremagic.com
        ReportedBy: samukha at 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: -------


More information about the Digitalmars-d-bugs mailing list