All pastes #902975 Raw Edit

Pseudo code

public text v1 · immutable
·published 2008-02-13 22:13 UTC
rendered paste body
/*
 * PubClass.php 
 */

<?php
class Publication 
{
	public $pub_id;
	public $pubName;
	
	public function Set_pub_id($value)
	{
		$this->pub_id = $value;
	}
	public function Get_pub_id()
	{ 
		return $this->pub_id ;
	}
	
	public function Set_pubName($value)
	{
		$this->pubName = $value;
	}
	public function Get_pubName()
	{ 
		return $this->pubName ;
	}
	
}

class Issue
{
	public $issue_id;
	public $issueName;
	
	public function Set_issue_id($value)
	{
		$this->issue_id = $value;
	}
	public function Get_issue_id()
	{ 
		return $this->issue_id ;
	}
	
	public function Set_issueName($value)
	{
		$this->issueName = $value;
	}
	public function Get_issueName()
	{ 
		return $this->issueName ;
	}
}
?>


/*
 * classTest.php
 */

<?php
require_once("PubClass.php");

echo ( "classTest.php<br/><br/>\n" );

$myPub = new Publication();
$myIssue = new Issue();

$myPub->Set_pub_id(1);
$myPub->Set_pubName("LiveMissoula!");

$myIssue->Set_issue_id(42);
$myIssue->Set_issueName("March 2008");

echo "[ var_dump of \$myPub ] <br/>\n";
var_dump($myPub);

echo "<br /><br />";

echo "[ var_dump of \$myIssue ] <br/>\n";
var_dump($myIssue);

?>

#---------#
# OUTPUT  #
#---------#

classTest.php

[ var_dump of $myPub ]
object(Publication)#1 (2) { ["pub_id"]=> int(1) ["pubName"]=> string(13) "LiveMissoula!" }

[ var_dump of $myIssue ]
object(Issue)#2 (2) { ["issue_id"]=> int(42) ["issueName"]=> string(10) "March 2008" }