<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>オブジェクト指向PHP &#187; メソッド</title>
	<atom:link href="http://www.objectphp.jp/tag/%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.objectphp.jp</link>
	<description>PHP5入門</description>
	<lastBuildDate>Tue, 31 Jan 2012 01:30:52 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>get_class_methods</title>
		<link>http://www.objectphp.jp/2009/11/18/get_class_methods/</link>
		<comments>http://www.objectphp.jp/2009/11/18/get_class_methods/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 01:55:39 +0000</pubDate>
		<dc:creator>mizuno</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[メソッド]]></category>

		<guid isPermaLink="false">http://www.objectphp.jp/?p=64</guid>
		<description><![CDATA[クラスで定義されているメソッドを配列として返す。引数にクラス名を指定]]></description>
			<content:encoded><![CDATA[<p>クラスで定義されているメソッドを配列として返す。引数にクラス名を指定する。<br />
<code><br />
get_class_methods('クラス名')<br />
</code><br />
メソッド一覧には、コンストラクタ __construct も含まれる。</p>
<p>private, protected 指定のメソッドについては、get_class_methods を呼び出すと、アクセス権のあるメソッド名のみが返される。例えば、クラスの外部で get_class_methods を実行すると、public メソッドのみの配列を生成する。</p>
<p>プロパティの一覧を取得する場合は、get_class_vars を使用する。<br />
引数はクラス名だが、オブジェクト名でも動作する。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.objectphp.jp/2009/11/18/get_class_methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>メソッドの隠蔽</title>
		<link>http://www.objectphp.jp/2007/09/14/method-2/</link>
		<comments>http://www.objectphp.jp/2007/09/14/method-2/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 23:26:32 +0000</pubDate>
		<dc:creator>mizuno</dc:creator>
				<category><![CDATA[カプセル化]]></category>
		<category><![CDATA[メソッド]]></category>

		<guid isPermaLink="false">http://www.objectphp.jp/encapsulation/method-2</guid>
		<description><![CDATA[メソッドの実装を気にする必要が無い]]></description>
			<content:encoded><![CDATA[<p>メソッドの実装を気にする必要が無いのも、隠蔽のメリットと言えるでしょう。</p>
<p><span id="more-65"></span></p>
<p>仮に、クラス内では価格がドルで計算されているとしましょう。個々のインスタンスにはドル建ての価格を与え、ドル円為替レートを掛けることで日本円の価格が計算されます。</p>
<pre>
    private $price;
    static private $rate_usdjpy;
    public function show_price() {
		return $this-&gt;price * $this-&gt;rate_usdjpy ;
	}
</pre>
<p>メソッドを外から呼び出す場合、戻り値として円建て価格を返してくれれば良いのです。クラス内部での価格の実装方法(円orドル)を考慮する必要はありません。ドル建てなら$priceはintでは無くてfloatなのか?といったことも考える必要はありません。(もっともPHPでは型を意識することは少ないですが。)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.objectphp.jp/2007/09/14/method-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

