Inheritance question
Regan Heath
regan at netmail.co.nz
Mon Aug 20 09:15:25 PDT 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());
}
More information about the Digitalmars-d-learn
mailing list