How can I call a function inside of a class that is an extension of another class?
<p>Okay, I know. I know... this one is probably an easy one. But, I'm very new to OOP and want to learn how to recycle my code more efficiently.</p>

<p>I have a class in php, and then another class that extends a previous class like so</p>

<pre><code>class team {
   private $league;
   private $team;
   public $year = 2013;

   function getTeamSeasonRecord($league, $team) {
   // Get given's team record thus far

      $this-&gt;record = $record;
     return $record;
}

class game extends team{

  public function __construct()
  {
        global $db;

        if($game_league == "mlb")
        {
            $table = "current_season_games";
        } else
        {
            $table = "".$game_league."_current_season_games";
        }

        $query = "SELECT * FROM ".$table." WHERE game_id = :game_id";
        $stmt = $db-&gt;prepare($query);
        $stmt-&gt;execute(array(':game_id' =&gt; $game_num));
        $count = $stmt-&gt;rowCount();

        $this-&gt;games_count = $count;

        if($count == 1)
        {
            $this-&gt;game_league = $game_league;
            $this-&gt;game_num = $game_num;

            while($row = $stmt-&gt;fetch(PDO::FETCH_ASSOC)) 
            {
                $home_team  = $row['home_team'];
                $away_team  = $row['away_team'];
                $game_int   = $row['game_date_int'];
                $game_date  = $row['game_date'];
                $game_time  = $row['game_time'];
            }

            $this-&gt;home_team = $home_team;
            $this-&gt;away_team = $away_team;
            $this-&gt;game_int = $game_int;
            $this-&gt;game_date = $game_date;
            $this-&gt;game_time = $game_time;
        }
    }

  $team_class = new team($this-&gt;game_league, $this-&gt;home_team, 2013);
  $record = $team_class-&gt;getTeamSeasonRecord($this-&gt;game_league, $this-&gt;home_team);
  $this-&gt;team_record -&gt; $record;
}
</code></pre>

<p>Since the class titled "game" is an extension of the class titled "team," can't the game class access all of the functions within the scope of the team class? The getTeamSeasonRecord() function that is written in the team class will find the record of any given team. But, for the game class, there are two teams. 1.) the home team and 2.) the away team. I need to find the records of both the home team and the away team. How can I recycle the code so that I don't have to have the same function in both classes?</p>
