[Issue 3282] New: The overload and override issue of const/immutable member functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 3 01:47:11 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3282

           Summary: The overload and override issue of const/immutable
                    member functions
           Product: D
           Version: 2.031
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: rayerd.wiz at gmail.com


import std.stdio;
class Base
{
    string f()
    {
        return "Base.f()";
    }
}
class Derived : Base
{
    string f()
    {
        return "Derived.f()";
    }
    string f() const // or immutable
    {
        return "Derived.f() const";
    }
}
void main()
{
    auto x = new Base;
    writeln(x.f());
    auto y = new Derived;
    writeln(y.f());
    auto z = new const(Derived); // or immutable
    writeln(z.f()); //object.Error: Access Violation
}

-- 
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