Virtual functions and inheritance
Baz via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jan 29 10:50:51 PST 2015
even more weird:
---
module test;
import std.conv;
interface Meh{
final string typeName()
{return to!string(this);}
}
class Parent : Meh {}
class Child : Parent {}
void main() {
auto p = new Parent;
auto c = new Child;
assert(p.typeName == __MODULE__ ~ ".Parent");
assert(c.typeName == __MODULE__ ~ ".Child");
}
---
More information about the Digitalmars-d-learn
mailing list