Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class osoba {
- protected $imie,$nazwisko,$rok_urodzenia;
- function __construct($i,$n,$r){
- $this -> imie = $i;
- $this -> nazwisko = $n;
- $this -> rok_urodzenia = $r;
- }
- function dane(){
- echo $this -> imie ." ".$this -> nazwisko." - ".(date("Y") - $this -> rok_urodzenia);
- }
- }
- class uczen extends osoba {
- private $klasa, $oceny, $przedmioty;
- function __construct($i,$n,$r,$k,$o,$p){
- parent::__construct($i,$n,$r);
- $this -> klasa = $k;
- $this -> oceny = $o;
- $this -> przedmioty = $p;
- }
- function dane(){
- echo $this -> imie ." ".$this -> nazwisko." - ".(array_sum($this -> oceny) / count($this -> oceny));
- }
- }
- $ns = new osoba('Adam','Kek',1999);
- $ns2 = new uczen('Krystix', 'Lawl',1233,'3k',[3,4,5,1,2,6,6,4],["Matematyka", "Polski", "Angielski"]);
- $ns2 -> dane();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement