Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ifrah Shahid
lab-exercises
Commits
c9f8d284
Commit
c9f8d284
authored
Feb 10, 2016
by
danmcquillan
Browse files
ca & dog classes for autoload
parent
69b773a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
week-15/simple-classes/cat.class.php
0 → 100644
View file @
c9f8d284
<?
/* Cat class extends Pet.
* Cat overrides play().
*/
class
Cat
extends
Pet
{
function
play
()
{
// Call the Pet::play() method:
parent
::
play
();
echo
"<p>
$this->name
is climbing.</p>"
;
}
}
// End of Cat class.
?>
week-15/simple-classes/dog.class.php
0 → 100644
View file @
c9f8d284
<?
/* Dog class extends Pet.
* Dog overrides play().
*/
class
Dog
extends
Pet
{
function
play
()
{
// Call the Pet::play() method:
parent
::
play
();
echo
"<p>
$this->name
is fetching.</p>"
;
}
}
// End of Dog class.
?>
week-15/simple-classes/pet.class.php
0 → 100644
View file @
c9f8d284
<?
class
Pet
{
public
$name
;
function
__construct
(
$pet_name
)
{
$this
->
name
=
$pet_name
;
self
::
sleep
();
}
function
eat
()
{
echo
"<p>
$this->name
is eating.</p>"
;
}
function
sleep
()
{
echo
"<p>
$this->name
is sleeping.</p>"
;
}
function
play
()
{
echo
"<p>
$this->name
is playing.</p>"
;
}
}
// End of Pet class.
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment