www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Minor Doc Fixes: in section Functions - Function Inheritance and

reply Bruno Medeiros <brunodomedeirosATgmail SPAM.com> writes:
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
May 07 2006
parent reply Walter Bright <newshound digitalmars.com> writes:
Thanks, I took care of it. -Walter
May 13 2006
parent reply Bruno Medeiros <brunodomedeirosATgmail SPAM.com> writes:
Walter Bright wrote:
 Thanks, I took care of it. -Walter

Are you sure you did? (looks unchanged to me) -- Bruno Medeiros - CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
May 18 2006
parent Bruno Medeiros <brunodomedeirosATgmail SPAM.com> writes:
Bruno Medeiros wrote:
 Walter Bright wrote:
 Thanks, I took care of it. -Walter

Are you sure you did? (looks unchanged to me)

Hum, it seems you fixed one of the examples(the 2nd), but there are still 2 more there (the 1st and the 3rd) that could be fixed (have unnecessary bar functions). -- Bruno Medeiros - CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
May 25 2006