Minor Doc Fixes: in section Functions - Function Inheritance and Overriding
Bruno Medeiros
brunodomedeirosATgmail at SPAM.com
Sun May 7 05:46:51 PDT 2006
In http://www.digitalmars.com/d/function.html , in the section "Function
Inheritance and Overriding", there are some simplifications that can be
made in the examples code. Namely, all those void bar(A a) functions are
pointless, and could be "inlined" in the test function. For example:
void test()
{
B b = new B();
bar(b);
}
void bar(A a)
{
a.foo(1); // calls A.foo(int)
B b = new B();
b.foo(1); // calls B.foo(long), since A.foo(int) not considered
}
could very well simply be:
void test()
{
B b = new B();
A a = b;
a.foo(1); // calls A.foo(int)
b.foo(1); // calls B.foo(long), since A.foo(int) not considered
}
I didn't check for other places in the doc that might be simplified so.
--
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d-bugs
mailing list