E
Erdal MUTLU
Hello,
I have problems with this simple program:
#include<iostream>
#include<fstream>
class Point {
public:
int x,y;
Point(int x=0,int y=0)
{ this->x=x; this->y=y; }
~Point() {}
};
class Curve {
public:
virtual int getValue(const double t)=0;
virtual ~Curve();
};
class LineCurve: public Curve {
private:
Point data[2];
double dt;
public:
int getValue(const double dt) { return 0; }
~LineCurve() {}
};
int main(void)
{
Curve* ptr;
ptr=new LineCurve;
return 0;
}
Wenn I comment ptr=new LineCurve; line out, then the code compiles.
Otherweis I get link errors. What is wrong here? It should be something
to do with virtuals, but I couldn't find it out?
Best regards.
Erdal Mutlu
I have problems with this simple program:
#include<iostream>
#include<fstream>
class Point {
public:
int x,y;
Point(int x=0,int y=0)
{ this->x=x; this->y=y; }
~Point() {}
};
class Curve {
public:
virtual int getValue(const double t)=0;
virtual ~Curve();
};
class LineCurve: public Curve {
private:
Point data[2];
double dt;
public:
int getValue(const double dt) { return 0; }
~LineCurve() {}
};
int main(void)
{
Curve* ptr;
ptr=new LineCurve;
return 0;
}
Wenn I comment ptr=new LineCurve; line out, then the code compiles.
Otherweis I get link errors. What is wrong here? It should be something
to do with virtuals, but I couldn't find it out?
Best regards.
Erdal Mutlu