- Registriert
- 14.02.07
- Beiträge
- 107
Hallo
Mal wieder ich der e-techniker, der keine Ahnung von C++ hat. Folgendes Programm zeigt mir Fehler zu Beginn der Klassen Graphobj. Kreis und Rechteck und zwar an der geschweiften Klammer heißt es // no matching function for call to Point:oint();
hier der Code:
HILFE
:-D:-D
Mal wieder ich der e-techniker, der keine Ahnung von C++ hat. Folgendes Programm zeigt mir Fehler zu Beginn der Klassen Graphobj. Kreis und Rechteck und zwar an der geschweiften Klammer heißt es // no matching function for call to Point:oint();
hier der Code:
Code:
#include<iostream>
#include"objekt.h"
using namespace std;
int main()
{
Point p1(0,0) , p2(3,4), p3(5,9), p4(5,9);
Kreis k1(p3,2);
Rechteck r1(p1,p2);
return 0;
}
Code:
#ifndef OBJEKT_H_
#define OBJEKT_H_
#include<iostream>
#include<cmath>
using namespace std;
class Point
{
public:
//friend Graphobj;
int x, y;
public:
//Point(){x=y=0;}
Point(int X,int Y)
{
x = X;
y = Y;
}
};
class Graphobj
{
public:
Point refPunkt;
public:
int distanz(Graphobj g2)
{
double d = 0;
d = sqrt((this->refPunkt.x-g2.refPunkt.x)*(this->refPunkt.x-g2.refPunkt.x)+(this->refPunkt.y-g2.refPunkt.y)*(this->refPunkt.y-g2.refPunkt.y));
return d;
}
};
class Rechteck : public Graphobj
{
private:
Point p1, p2;
public:
Rechteck(Point d1, Point d2)
{
p1 = d1;
//p1.y = d1.y;
p2 = d2;
//p2.y = d2.y;
this->refPunkt.x = (p2.x - p1.x)/2.;
this->refPunkt.y = (p2.y - p1.y)/2.;
}
};
class Kreis : public Graphobj
{
private:
Point mittelpkt;
float radius;
public:
Kreis( Point mP, float r)
{
mittelpkt = mP;
radius = r;
refPunkt = mP;
}
};
#endif /*OBJEKT_H_*/
HILFE
:-D:-D