Prosze o pomoc. Daje NAJ.
Zaimplementuj w języku c++ klasę osoba:
-Pola:imię, nazwisko, PESEL
-metody:konstruktor(z parametrami), wypisz(wypisuje dane osoby),
PESEL(zaprzyjaźniona metoda zwracająca pesel danej osoby).
Nadaj odpowiednie specyfikatory dostępu do poszczególnych pól i metod
" Life is not a problem to be solved but a reality to be experienced! "
© Copyright 2013 - 2025 KUDO.TIPS - All rights reserved.
#include <iostream>
#include <string>
class Osoba {
public:
Osoba(std::string imie, std::string nazwisko, std::string pesel) {
this->imie = imie;
this->nazwisko = nazwisko;
this->pesel = pesel;
}
void wypisz() {
std::cout << "Imie: " << imie << std::endl;
std::cout << "Nazwisko: " << nazwisko << std::endl;
std::cout << "PESEL: " << pesel << std::endl;
}
friend std::string PESEL(Osoba &o);
private:
std::string imie;
std::string nazwisko;
std::string pesel;
};
std::string PESEL(Osoba &o) {
return o.pesel;
}