[ create a new paste ] login | about

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

C++, pasted on Nov 15:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class A{};
class B :public A
{
    public: B operator + (const B &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:
1
2
3
In function 'int main()':
Line 17: error: no match for 'operator+' in '* *(ptrA + 4u) + * *(ptrA + 8u)'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: