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 = "3k", $oceny = [3,4,5,1,2,6,6,4], $przedmioty = ["Matematyka", "Polski", "Angielski"];
- 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', 1232);
- $ns2 -> dane();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement