is this a poly Polymorphism?

hhaammaadd h.battel at hotmail.com
Sun Aug 28 18:50:09 PDT 2011


import std.stdio;
class employee {
         void work() {
                 writeln("I am employee");
         }
}

class manager: employee {
         void work() {
                 writeln("I am manager");
                 }
}


void main() {
         employee e1 = new manager;//here
         e1.work();

         manager m3 = new manager;//--|here
         employee *e2 = &m3;//--------|
         e2.work();


}



More information about the Digitalmars-d-learn mailing list