All pastes #900349 Raw Edit

PHP 5 OOP stab

public text v1 · immutable
·published 2008-02-11 21:05 UTC
rendered paste body
// pub.class.php

abstract class Publications
{
	protected $publication_id ;
	protected $co_id ;
	protected $coName ;
	protected $webEmailLink ;
	
	protected function __construct( ) 
	{
		print "In BaseClass constructor\n";
	}

	public function Set_publication_id($value)
	{
		$this->publication_id = $value;
	}
	protected function Get_publication_id()
	{ 
		return $this->publication_id ;
	}

	protected function Set_co_id($value)
	{
		$this->co_id = $value;
	}
	protected function Get_co_id()
	{ 
		return $this->co_id ;
	}

	protected function Set_coName($value)
	{
		$this->coName = $value;
	}
	protected function Get_coName()
	{ 
		return $this->coName ;
	}
	
	protected function Set_webEmailLink($value)
	{
		$this->webEmailLink = $value;
	}
	protected function Get_webEmailLink()
	{ 
		return $this->webEmailLink ;
	}
}

class Issues extends Publications
{
	protected $issue_id ;
	
	protected function __construct( )
	{
    	print "In SubClass constructor\n";
	}
	protected function Set_issue_id($value)
	{
		$issue_id = $value;
	}
	protected function Get_issue_id()
	{ 
		return $issue_id ;
	}
	
	protected function PrintIssueDetails()
	{
		echo (	$this->publication_id . " - " . 
				$this->co_id.  " - " . 
				$this->coName . " - " .
				$this->webEmailLink ) ;
	}
}
//END


// another.php
<?php

require_once("../include/class/pubs.class.php");

$myIssue = array( ) ;

$myIssue[0] = new Issues( ) ;

$myIssue[0]->Set_publication_id(45);

var_dump ( $myIssue[0] ) ;
echo "<br />";

$myIssue[0]->PrintIssueDetails();

?>