[ create a new paste ] login | about

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

C++, pasted on Jun 20:
#include<iostream>
using namespace std;
class A
{
public:
    void method()const{cout<<"A"<<endl;}
};
 
class B
{
public:
    void method()const{cout<<"B"<<endl;}
};
 
class Client
{
public:
    template<typename Type>
    Client(const Type&value){value.method();}
};
 
int main()
{
    A a;
    B b;
    Client c1(a);
    Client c2(b);
    c1=c2;//Разные типы, говорите?
}


Output:
1
2
A
B


Create a new paste based on this one


Comments: