[ create a new paste ] login | about

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

C++, pasted on Jun 3:
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>

class A{};
class B:public A{};
class C:public A{};
int main(void)
{
B *p = new B;
C *q = new C;
std::cout << (p == q) << std::endl;
return 0;
}


Output:
1
2
3
In function 'int main()':
Line 10: error: comparison between distinct pointer types 'B*' and 'C*' lacks a cast
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: