[Issue 3757] New: The overload and override issue of const/immutable member functions -2nd-
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jan 30 19:30:08 PST 2010
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: nobody at puremagic.com
ReportedBy: rayerd.wiz at gmail.com
Depends on: 3282
--- Comment #0 from Haruki Shigemori <rayerd.wiz at 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: -------
More information about the Digitalmars-d-bugs
mailing list