[ create a new paste ] login | about

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

C++, pasted on Jul 25:
#include <iostream>

using namespace std;

template<class T, class ST=T>
class A
{
public:
    virtual void foo(T a, ST b) = 0;
};

template<class T, class ST=T>
class B : public A<T, T>
{
public:
    virtual void bar(T a, ST b) = 0;
};

class C : public B<long double, int>
{
public:
    virtual void foo(long double ld, long double ld1)
    {
        cout << ld*ld1 << endl;
    }
    virtual void bar(long double ld, int i)
    {
        cout << sizeof(i) << endl;
        foo(ld, ld);
    }
};

int main()
{
    long double ld=0.0;
    int i=0;
    C c;
    c.bar(ld, i);
    return 0;
}


Output:
1
2
4
0


Create a new paste based on this one


Comments: