Permalink
Browse files

Preliminary step: extracted superclass

  • Loading branch information...
giorgiosironi committed Jan 19, 2012
1 parent 5064516 commit 7f2e843a5a0e2c455fe209f28e8b1786e9a5875b
Showing with 7 additions and 13 deletions.
  1. +7 −13 FormTemplateMethod.php
View
@@ -16,34 +16,28 @@ public function testAnArticleTweet()
}
}
-class VideoTweet
+class Tweet
{
- private $url;
- private $title;
+ protected $url;
+ protected $title;
public function __construct($url, $title)
{
$this->url = $url;
$this->title = $title;
}
+}
+class VideoTweet extends Tweet
+{
public function __toString()
{
return "Check out this video: $this->title $this->url";
}
}
-class ArticleTweet
+class ArticleTweet extends Tweet
{
- private $url;
- private $title;
-
- public function __construct($url, $title)
- {
- $this->url = $url;
- $this->title = $title;
- }
-
public function __toString()
{
return "RT @DZone: $this->title $this->url";

0 comments on commit 7f2e843

Please sign in to comment.