Gdzie jest błąd ze nie mogę utworzyć obiektu k1 ?
#include <iostream>
#include <math.h>
using namespace std;
class Punkt
{
float x,y;
string nazwa;
public:
void wyswietl()
{
cout<<nazwa<<"("<<x<<","<<y<<")"<<endl;
}
Punkt(string n, float a=0,float b=0)
{
nazwa=n;
x=a;
y=b;
}
};
class Kolo :public Punkt //klasa kolo dzidziczy z punkt
{
float r;
string nazwa;
public:
void wyswietl()
{
cout<<"kolo o nazwie: "<<nazwa<<endl;
cout<<"srodek kola: "<<endl;
Punkt::wyswietl();
cout<<"Promien: "<<r<<endl;
cout<<"pole kola: "<<M_PI*r*r<<endl;
}
Kolo(string nk, string np,float a,float b,float pr):Punkt(np,a,b)
{
nazwa=nk;
r=pr;
}
};
int main()
{
Kolo k1;
k1.wyswietl();
return 0;
}