[ create a new paste ] login | about

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

C++, pasted on Feb 4:
#include <iostream>

template<typename SampleType>
class Generic
{
    public:
    
        void outer(const SampleType sample)
        {
            this->inner(sample);
        };

        virtual void inner(const SampleType sample) = 0;

};

//
// Spezialization.
//
 
class Doubled : public Generic<double*> 
{
    public:
        
        virtual void inner(const double* sample)
        {
            std::cout << "processing for double* " << std::endl;
        }
};

 
int main (int argc, char const *argv[])
{
    double* sample = new double[2];
    Doubled doubled ;
    doubled.outer(sample);
    return 0;
}


Output:
1
2
3
In function 'int main(int, const char**)':
Line 35: error: cannot declare variable 'doubled' to be of abstract type 'Doubled'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: