#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="S", float a=0, float b=0)
{
nazwa=n;
x=a;
y=b;
}
};
class Kolo :public Punkt
{
public:
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="kolko", string np="s", float a=0, float b=0, float pr=1)
:Punkt(np,a,b)
{
nazwa=nk;
r=pr;
}
};
class Kula :public Kolo
{
string nazwa;
float v;
public:
void wyswietl()
{
Kolo::wyswietl();
cout<<"Objetosc kuli: "<<nazwa<<endl;
cout<<"wynosi: "<<4/3*M_PI*r*r*r<<endl;
}
Kula(string no="kula", string np="s", float a=0, float b=0, float pr=1, float vk=0)
:Punkt(np,a,b) :Kolo(nk,pr)
{
nazwa=no;
v=vk;
}
};
int main()
{
Kula k1;
k1.wyswietl();
return 0;
}
Dokładnie nie wiem o co chodzi ale chyba o to że nie mam zaprzyjaźnionego class Punkt do class Kula.
I właśnie nie wiem jak zaprzyjaźnić obie powyższe class do class Kula