August 20, 2007
How do I hide A's getname()and use another method name for it? I wanted the user of my class B to use the getnewname() instead of using getname() which is inherited from class A.

    class A {
      private char[] _name;
      public char[] getname() { return _name; }
      ...
    }

    class B : A {
      public char[] getnewname() { return A.getname(); }
      ...
    }

    void main() {
      B b;
      ...
      writefln(b.getnewname());
    }


-- 
negerns
August 20, 2007
You could use deprecated like so:

import std.stdio;

class A {
	private char[] _name;
	this(char[] name) { _name = name; }
	public char[] getname() { return _name; }
}

class B : A {
	this(char[] name) { super(name); }
	public char[] getnewname()  { return A.getname(); }
	deprecated char[] getname() { return A.getname(); }
}

void main() {
	B b = new B(cast(char[])"test");
	writefln(b.getname());  //Error: function dep.B.getname is deprecated
	writefln(b.getnewname());
}