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

           Summary: The overload and override issue of const/immutable
                    member functions -2nd-
           Product: D
           Version: 2.040
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: rayerd....@gmail.com
        Depends on: 3282


--- Comment #0 from Haruki Shigemori <rayerd....@gmail.com> 2010-01-30 19:30:03 
PST ---
import std.stdio;
class Base
{
    string f()
    {
        return "Base.f()";
    }
}
class Derived : Base
{
    string f()
    {
        return "Derived.f()";
    }
    string f() const
    {
        return "Derived.f() const";
    }
}
void main()
{
    auto x = new Base;
    writeln(x.f());
    auto y = new Derived;
    writeln(y.f());// calls "Derived.f() const", but it is expected that be
called non-const. 
    auto z = new const(Derived);
    writeln(z.f());
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to