<?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>追風箏的小孩 &#187; 物件導向</title>
	<atom:link href="http://m955.com/wp/archives/tag/%e7%89%a9%e4%bb%b6%e5%b0%8e%e5%90%91/feed" rel="self" type="application/rss+xml" />
	<link>http://m955.com/wp</link>
	<description></description>
	<lastBuildDate>Thu, 03 Nov 2011 14:47:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>物件導向無痛入門(4)-屬性(Property)的概念</title>
		<link>http://m955.com/wp/archives/121</link>
		<comments>http://m955.com/wp/archives/121#comments</comments>
		<pubDate>Sun, 18 May 2008 16:27:02 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[物件導向]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=121</guid>
		<description><![CDATA[　　我們在上一篇 物件導向無痛入門(3)-基本建立類別 的正妹範例中有用到 屬性(Property) 來約束所輸入的條件值，屬性 (Property) 的使用時機是來確保 USER 所輸入的值是正確的，而避免錯誤產生... ]]></description>
			<content:encoded><![CDATA[<p>　　我們在上一篇 <a href="http://m955.com/wp/archives/120">物件導向無痛入門(3)-基本建立類別</a> 的正妹範例中有用到 屬性(Property) 來約束所輸入的條件值，屬性 (Property) 的使用時機是來確保 USER 所輸入的值是正確的，而避免錯誤產生。<br />
<span id="more-121"></span><br />
　　屬性(Property) 分為唯讀區，跟唯寫區，什麼意思呢？就是說在 GET 一區的值只可以讀出，SET 一區的值只可以寫入由於設計類別是供自己或其他程設師使用，如果輸入的值沒有加以管制的話，那麼很容易就會有錯誤產生。</p>
<p>範例1：計算發票金額<br />
　　沒有設定 屬性(Property) 時，如果使用者輸入 -100，那麼算出的金額就會變負項，這樣很容易產生錯誤</p>
<p><img src='http://farm4.static.flickr.com/3232/2501715137_6550c8f7a7_o.png' alt='' class='alignnone' /></p>
<div class="igBar"><span id="lvbnet-3"><a href="#" onclick="javascript:showPlainTxt('vbnet-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-3">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Class</span> Rat</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'計算發票的稅金</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _price <span style="color: #FF8000;">As</span> Int32</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Sub</span> <span style="color: #FF8000;">New</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> price <span style="color: #FF8000;">As</span> Int32<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._price = price</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'計算稅金的方法</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Function</span> <span style="color: #0600FF;">rate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> r <span style="color: #FF8000;">As</span> Int32 = <span style="color: #FF0000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; r = <span style="color: #FF8000;">Me</span>._price * <span style="color: #FF0000;color:#800000;">0</span>.<span style="color: #FF0000;color:#800000;">05</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Return r</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>範例2：<br />
　　設定 屬性(Property) 時，如果使用者輸入 -100，那麼本金就會設定成 0，輸出的稅金自然也會是 0，這樣可以避免錯誤的產生</p>
<p><img src='http://farm4.static.flickr.com/3020/2502543430_9ffaefe53c_o.png' alt='' class='alignnone' /></p>
<div class="igBar"><span id="lvbnet-4"><a href="#" onclick="javascript:showPlainTxt('vbnet-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-4">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Class</span> Rat</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'計算發票的稅金</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _price <span style="color: #FF8000;">As</span> Int32</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Sub</span> <span style="color: #FF8000;">New</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> price <span style="color: #FF8000;">As</span> Int32<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">price</span> = price</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> <span style="color: #FF8000;">Property</span> price<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> Int32</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return <span style="color: #FF8000;">Me</span>._price</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> value <span style="color: #FF8000;">As</span> Int32<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> value &lt;<span style="color: #FF0000;color:#800000;">0</span> <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._price = <span style="color: #FF0000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._price = value</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Set</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Property</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Function</span> <span style="color: #0600FF;">rate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> r <span style="color: #FF8000;">As</span> Int32 = <span style="color: #FF0000;color:#800000;">0</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; r = <span style="color: #FF8000;">Me</span>._price * <span style="color: #FF0000;color:#800000;">0</span>.<span style="color: #FF0000;color:#800000;">05</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Return r</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/121/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>物件導向無痛入門(3)-基本建立類別</title>
		<link>http://m955.com/wp/archives/120</link>
		<comments>http://m955.com/wp/archives/120#comments</comments>
		<pubDate>Sun, 18 May 2008 12:53:56 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[物件導向]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/120</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160; 在物件導向中，類別(Class)是最基本的課程，有類別(Class)，才能產生物件(Object)，類別裡包含有：變數(Var)、屬性(Property)、方法(Method)，我知道這些名詞都很抽象... ]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 在物件導向中，類別(Class)是最基本的課程，有類別(Class)，才能產生物件(Object)，類別裡包含有：變數(Var)、屬性(Property)、方法(Method)，我知道這些名詞都很抽象，我慢慢解釋給你聽。 </p>
<p><span id="more-120"></span></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 延續上一篇 物件導向無痛入門(1) 的概念，請你把物件想像成公司裡的員工，而每一個員工可以做很多事情，這就是物件；身為人事部經理的你，今天老總打電話給你，說他要應徵一個秘書，然後他開出了應徵的條件，叫你3天內馬上找到人，老總的條件如下：</p>
<ol>
<li>18～27歲的正妹</li>
<li>未婚</li>
<li>36C</li>
<li>170CM</li>
<li>配合度高</li>
</ol>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 這裡所說的應徵條件，你就可以把他看成 <font color="#0000ff">類別(Class)</font>，然後用來產生 <font color="#0000ff">正妹秘書(物件 Object)</font>，於似乎你就上網 POST 了應徵的條件，果然不出3天就有人來應徵了，你就照著老總的條件來面試，當然面試的時候我們必須要驗證正妹的資料是否正確，而驗證正妹的規則就是可以看成 <font color="#0000ff">屬性(Property)</font>，設規則就是要保證產生的物件合乎標準！</p>
<p>讓我們把它換成程式表示吧！</p>
<p>先寫個秘書類別吧！</p>
<div class="igBar"><span id="lvbnet-7"><a href="#" onclick="javascript:showPlainTxt('vbnet-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-7">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Class</span> Secretary</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'設定變數</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _name <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _age <span style="color: #FF8000;">As</span> Int32</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _ISmarry <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _ISc <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _height <span style="color: #FF8000;">As</span> Int32</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _ISmatch <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> _score <span style="color: #FF8000;">As</span> Int32 = <span style="color: #FF0000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'建構子</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Sub</span> <span style="color: #FF8000;">New</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> name <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>, <span style="color: #FF8000;">ByVal</span> age <span style="color: #FF8000;">As</span> Int32, _</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">ByVal</span> ISmarry <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span>, <span style="color: #FF8000;">ByVal</span> ISc <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span>, _</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">ByVal</span> height <span style="color: #FF8000;">As</span> Int32, <span style="color: #FF8000;">ByVal</span> ISmatch <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">name</span> = name</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">age</span> = age</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">ISmarry</span> = ISmarry</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">ISc</span> = ISc</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">height</span> = height</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">ISmatch</span> = ISmatch</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'設定正妹名字</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Property</span> name<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return <span style="color: #FF8000;">Me</span>._name</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> value <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._name = value</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Set</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Property</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'驗證年齡</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Property</span> age<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> Int32</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return <span style="color: #FF8000;">Me</span>._age</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> value <span style="color: #FF8000;">As</span> Int32<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> value&gt; <span style="color: #FF0000;color:#800000;">18</span> <span style="color: #804040;">And</span> value &lt;<span style="color: #FF0000;color:#800000;">27</span> <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._age</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._score += <span style="color: #FF0000;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._age</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Set</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Property</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'是否結婚</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Property</span> ISmarry<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return <span style="color: #FF8000;">Me</span>._age</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> value <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> value = <span style="color: #0600FF;">False</span> <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._ISmarry</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._score += <span style="color: #FF0000;color:#800000;">1</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._ISmarry</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Set</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Property</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'是否大於C</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Property</span> ISc<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return <span style="color: #FF8000;">Me</span>._ISc</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> value <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> value = <span style="color: #0600FF;">True</span> <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._ISc</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._score += <span style="color: #FF0000;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._ISc</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Set</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Property</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'驗證身高</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Property</span> height<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> Int32</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return <span style="color: #FF8000;">Me</span>._height</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> value <span style="color: #FF8000;">As</span> Int32<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> value&gt; <span style="color: #FF0000;color:#800000;">170</span> <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._height</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._score += <span style="color: #FF0000;color:#800000;">1</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._height</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Set</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Property</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'配合高</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Property</span> ISmatch<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return <span style="color: #FF8000;">Me</span>._ISmatch</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Get</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> value <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> value = <span style="color: #0600FF;">True</span> <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._ISmatch</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Me</span>._score += <span style="color: #FF0000;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = <span style="color: #FF8000;">Me</span>._ISmatch</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Set</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #FF8000;">Property</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'是否率取</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Sub</span> matriculate<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> <span style="color: #FF8000;">Me</span>._score&gt;= <span style="color: #FF0000;color:#800000;">5</span> <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">MsgBox</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">Me</span>._name &amp; vbCrLf &amp; _</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080;">"恭喜你錄取了"</span> &amp; vbCrLf &amp; _</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080;">"總分："</span> &amp; <span style="color: #FF8000;">Me</span>._score<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">MsgBox</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">Me</span>._name &amp; vbCrLf &amp; _</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080;">"抱歉你沒錄取"</span> &amp; vbCrLf &amp; _</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080;">"總分："</span> &amp; <span style="color: #FF8000;">Me</span>._score<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>在主程式裡宣告三個應徵者</p>
<div class="igBar"><span id="lvbnet-8"><a href="#" onclick="javascript:showPlainTxt('vbnet-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-8">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Class</span> Form1</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Sub</span> Form1_Load<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> sender <span style="color: #FF8000;">As</span> System.<span style="color: #FF0000;">Object</span>, _</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">ByVal</span> e <span style="color: #FF8000;">As</span> System.<span style="color: #0000FF;">EventArgs</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Handles</span> <span style="color: #FF8000;">MyBase</span>.<span style="color: #0000FF;">Load</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> girl1 <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> Secretary<span style="color: #000000;">&#40;</span><span style="color: #808080;">"張佩君"</span>, <span style="color: #FF0000;color:#800000;">20</span>, <span style="color: #0600FF;">False</span>, <span style="color: #0600FF;">True</span>, <span style="color: #FF0000;color:#800000;">172</span>, <span style="color: #0600FF;">True</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; girl1.<span style="color: #0000FF;">matriculate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> girl2 <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> Secretary<span style="color: #000000;">&#40;</span><span style="color: #808080;">"張秀慧"</span>, <span style="color: #FF0000;color:#800000;">28</span>, <span style="color: #0600FF;">True</span>, <span style="color: #0600FF;">True</span>, <span style="color: #FF0000;color:#800000;">165</span>, <span style="color: #0600FF;">True</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; girl2.<span style="color: #0000FF;">matriculate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> girl3 <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> Secretary<span style="color: #000000;">&#40;</span><span style="color: #808080;">"王淑芬"</span>, <span style="color: #FF0000;color:#800000;">25</span>, <span style="color: #0600FF;">False</span>, <span style="color: #0600FF;">False</span>, <span style="color: #FF0000;color:#800000;">174</span>, <span style="color: #0600FF;">True</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; girl3.<span style="color: #0000FF;">matriculate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><img src="http://farm3.static.flickr.com/2015/2502016300_1b5521038d_o.png" /> <img src="http://farm4.static.flickr.com/3055/2501187947_7a0119bcbb_o.png" /> <img src="http://farm3.static.flickr.com/2398/2501187927_72015dfbf7_o.png" /></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/120/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>物件導向無痛入門(2)-物件導向概念</title>
		<link>http://m955.com/wp/archives/163</link>
		<comments>http://m955.com/wp/archives/163#comments</comments>
		<pubDate>Sun, 18 May 2008 10:57:30 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[物件導向]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/163</guid>
		<description><![CDATA[先類別談起，首先要搞懂物件導向，必須先搞清楚，啥是類別？啥是物件？這兩個名詞懂了之後，基本的物件導向精神就懂了一大半了，類別是一個藍圖，他可以產生出物件這個東西，示意圖... ]]></description>
			<content:encoded><![CDATA[<p>先類別談起，首先要搞懂物件導向，必須先搞清楚，啥是類別？啥是物件？這兩個名詞懂了之後，基本的物件導向精神就懂了一大半了，類別是一個藍圖，他可以產生出物件這個東西，示意圖如下：</p>
<p align="center"><a href="http://farm4.static.flickr.com/3272/3018481392_037d461988_o.png" target="_blank" rel="lightbox"><img src="http://farm4.static.flickr.com/3272/3018481392_b0582e10fa.jpg" /></a></p>
<p><span id="more-163"></span></p>
<p>由上圖我們可以瞭解到，我們定義了一個正妹類別，然後可以在主程式裡以 NEW 語法宣告產生一個物件，然後設定類別中所定義的屬性(身高、體重...)，就可以產生正妹一或正妹二的物件，沒錯！就是這樣而已。</p>
<p>因為有了類別，所以我們不需要宣告很多參數，來放每個個體的參數，可以大大減少程式碼的撰寫，也可以有效的提高程式的可讀性。</p>
<p>入門之後，接下來來看看其他物件導向的名詞，與做法解釋：</p>
<p><font color="#0000ff">一、繼承(Inheritance)      <br /></font>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 子類別可以繼承父類別所用有的方法和屬性，優點：節省軟體重複開發，以達到軟體再利用。</p>
<p><font color="#0000ff">二、多載(Overloading)與重寫(Overriding)      <br /></font>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Overloading，「重複定義」，在同一個命名空間裡，可以同時存在多個相同名稱，但不同參數個數或是參數型態的函示。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Overriding，「重新定義」，指子類別，可將父類別中定義的 Method(方法) 重新定義，使得父類別的方法失效的一種技術。</p>
<p><font color="#0000ff">三、封裝(Encapsulation)      <br /></font>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 將寫好的類別包成一個 .dll 檔，只提供 Method(方法)，Property(屬性)，供程式設計師使用，別人卻無法得知封裝好的 DLL 檔案內部的的程序如何撰寫，以達到資訊隱藏的特性，避免重要資訊 (演算法、資料結構...) 外流。</p>
<p><font color="#0000ff">四、資料抽象化/抽象資料型別(Data abstraction / Abstract Data Type)      <br /></font>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 這是一個將物件與運算分開的資料型態，所定義出來的類別，只可以繼承，無法直接宣告。</p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/163/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>物件導向無痛入門(1)</title>
		<link>http://m955.com/wp/archives/118</link>
		<comments>http://m955.com/wp/archives/118#comments</comments>
		<pubDate>Sun, 18 May 2008 10:55:42 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[物件導向]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=118</guid>
		<description><![CDATA[　　近年來物件導向漸漸成為各程式語言的主流，從結構化語言→函數→物件導向，這一切的演進，其實都是符合自然的，而各種學習語言也應該如此，有人曾經說過，學習各種語言的時候，... ]]></description>
			<content:encoded><![CDATA[<p>　　近年來物件導向漸漸成為各程式語言的主流，從結構化語言→函數→物件導向，這一切的演進，其實都是符合自然的，而各種學習語言也應該如此，有人曾經說過，學習各種語言的時候，不應該一開始就從物件導向開始，我猜想他的意思也應該跟我差不多，應該循序漸進，才能收到效果。</p>
<p><span id="more-118"></span></p>
<p>　　程式剛入門時，我們學習的是基本的程式架構，從變數、型別、運算、迴圈、判斷、陣列，這以上六個課題涵蓋了所有程式本質的精神，之後才是、函式、指標。</p>
<p>　　當我們學會六個基本的課程之後，開始依照我們的想法撰寫程式，然而當我們程式越寫越多、越寫越大的同時，會發現有很多的程式碼都是重複的，當然很多人早就發現了，所以函式就產生了！</p>
<p>　　函式是把程式中重複的地方整理在一起，當我們有需要的時候再行呼叫即可，舉例說明：某一程式中需要經常運算從 N 加到 M 的值，我們就可以把規則性整理出來，寫成函式，然後等到我們需要運算時，呼叫此一函式，並將 N 和 M 的值丟入，函式就會把計算的結果回傳回來，而不用為了計算而另行撰寫程式，不僅減少了程式碼的撰寫，而且也可以減少程式的執行時間，一舉兩得！</p>
<p>　　然而當我們快樂的使用函數的同時，會發現到，一個函式只能夠處理一件事，當有很多功能時，我們就需要撰寫很多函式來解決，這似乎不是所有事件的最佳解決方案，如果一個函式可以處理很多東西那該有多好...，所以，物件導向就產生了！</p>
<p>　　把程式想像成一個部門，一個部門必須處理很多事務(Function 可以把它視為函式)，而每一個員工可以處理很多事務(打字、報告、做圖表...)，這樣的部門辦起事來是不是就很有效率，物件導向的物件就是類似以上說的員工，簡單的說，物件就是一個把變數，函式包在一起的一種技術。</p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/118/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

