Основы ООП. Наследование
Практические задания
Краткое содержание лекции |
Теоретические задания
Транспорт
Измените следующий листинг кода на ваше усмотрение.
(index.php) download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| <?php
$bus = new Transport();
$bus->owner = 'School';
$bus->model = 'BMW';
$bus->year = 2013;
$bus->driver = 'Don Dead - scool driver';
$bus->speed = 40;
$airplan = new Transport();
$airplan->owner = 'Airflot';
$airplan->model = 'TU-154';
$airplan->year = 2000;
$airplan->pilot = 'Pilot';
$airplan->co_pilot = 'Co-pilot';
$airplan->speed = 1600;
$airplan->wingspan = 50;
$car = new Transport();
$car->owner = 'Sam Sam';
$car->model = 'bugati';
$car->year = 2010;
$car->speed = 320;
$car->accelerationTo100 = 7;
$car->airbag = true;
|
(Transport.php) download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
| <?php
class Transport
{
/**
* @var string
*/
public $owner;
/**
* @var string
*/
public $model;
/**
* @var integer
*/
public $year;
/**
* @var string
*/
public $pilot;
/**
* @var string
*/
public $co_pilot;
/**
* @var string
*/
public $driver;
/**
* @var string
*/
public $wingspan;
/**
* @var boolean
*/
public $airbag = false;
/**
* @var integer
*/
public $speed;
/**
* @var integer
*/
public $accelerationTo100;
}
|