[ create a new paste ] login | about

Link: http://codepad.org/B6wLRno9    [ raw code | fork ]

C++, pasted on Nov 15:
class A
{
    public: virtual A & operator + (const A &obj) = 0;
};

class B : public A
{
    public: B & operator + (const A &obj)
    {
        return *this;
    }
};

int main()
{
    A** ptrA = new A*[3];
    B obj[3];
    for (int i = 0; i < 3; i++)
        ptrA[i] = &obj[i];

    *ptrA[0] = *ptrA[1] + *ptrA[2];
    return 0;   
}


Output:
No errors or program output.


Create a new paste based on this one


Comments: