Links

Categories

Tags


« | Main | »

Single inheritance and virtual methods

By Jewe | January 12, 2015

class A
{
    method A()
    {
    }
    virtual method M()
    {
    }
    method N()
    {
        M(); // virtual call to M()
    }
}

class B extends A
{
    method B() extends A()
    {
    }
    method N() // override N()
    {
        base.N(); // and call base
    }
    method M() // override M()
    {
        // we end up here if we call B::N()
    }
}

Topics: code examples | Comments Off on Single inheritance and virtual methods

Comments are closed.