Potrzebuje pomocy w zadaniu z dziedziczenia..
Wklejam cały mój kod źródłowy jakby ktoś chciał odpalić u siebie, korzystam z visual studio 2017
Chciałem wyświetlić to co znajduje się metodzie Main lecz nie wiem co robię źle
Ktoś ma jakiś pomysł ?
#include <iostream>
#include <fstream>
#include <conio.h>
#include <conio.h>
#include <stdio.h>
#include <string>
using namespace std;
#pragma warning(default:4716)
class Osoba
{
private:
string imie ;
string nazwisko ;
string dataUrodzenia ;
public:
Osoba() {}
Osoba(string n) : imie(n) , nazwisko(n) , dataUrodzenia(n) {};
~Osoba() { cout << "Usunieto Obiekt" << endl; }
void WypiszInfo() {
cout << "Imie: " << imie << endl;
cout << "Nazwisko: " << nazwisko << endl;
cout << "Data Urodzenia: " << dataUrodzenia << endl;
}
};
class Student : public Osoba
{
private:
int rok ;
int grupa ;
int nrIndeksu;
public:
Student() {};
Student( const int r) : rok(r) , grupa(r) , nrIndeksu(r) {};
void WypiszInfo() {
cout << "Rok: " << rok << endl;
cout << "Grupa " << grupa << endl;
cout << "Nr Indeksu " << nrIndeksu << endl;
}
};
class Pilkarz : public Osoba
{
private:
string pozycja ;
string klub ;
int liczbaGoli = 0;
public:
Pilkarz() {};
Pilkarz(const string &n, const int r) : pozycja(n) , klub(n) , liczbaGoli(r) {};
void WypiszInfo() {
cout << "Pozycja: " << pozycja << endl;
cout << "Klub: " << klub<< endl;
cout << "Liczba Goli: " << liczbaGoli << endl;
}
};
int main() {
Osoba O("Kamil", "Kot", "10.10.1990");
O.WypiszInfo();
Student s("Kacper", "Nowak", "15.10.1995", 3, 5, 2523);
s.WypiszInfo();
Pilkarz p("Marek", "Dach", "18.12.1997", "Napastnik", "FC Kot", 10);
p.WypiszInfo();
getchar();
return 0;
}