ÓÑÇéÌáʾ£ºÈç¹û±¾ÍøÒ³´ò¿ªÌ«Âý»òÏÔʾ²»ÍêÕû£¬Çë³¢ÊÔÊó±êÓÒ¼ü¡°Ë¢Ð¡±±¾ÍøÒ³£¡
¸»Ê¿¿µÐ¡ËµÍø ·µ»Ø±¾ÊéĿ¼ ¼ÓÈëÊéÇ© ÎÒµÄÊé¼Ü ÎÒµÄÊéÇ© TXTÈ«±¾ÏÂÔØ ¡ºÊղص½ÎÒµÄä¯ÀÀÆ÷¡»

VB2008´ÓÈëÃŵ½¾«Í¨(PDF¸ñʽӢÎÄ°æ)-µÚ32²¿·Ö

¿ì½Ý²Ù×÷: °´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·­Ò³ °´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ °´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿! Èç¹û±¾ÊéûÓÐÔĶÁÍ꣬ÏëÏ´μÌÐø½Ó×ÅÔĶÁ£¬¿ÉʹÓÃÉÏ·½ "Êղص½ÎÒµÄä¯ÀÀÆ÷" ¹¦ÄÜ ºÍ "¼ÓÈëÊéÇ©" ¹¦ÄÜ£¡





¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡#Const¡¡ACTIVATE_1¡¡=¡¡True¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Namespace¡¡TestDefine¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Class¡¡Example¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡#If¡¡ACTIVATE_1¡¡Then¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Private¡¡_dataMember¡¡As¡¡Integer¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡#ElseIf¡¡Not¡¡NO_ACTIVATE_10¡¡Then¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Private¡¡_dataMember3¡¡As¡¡Integer¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡#Else¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Private¡¡_defaultValue¡¡As¡¡Integer¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡#End¡¡If¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Class¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Namespace¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡In¡¡general£»¡¡you¡¡will¡¡use¡¡preprocessor¡¡directives¡¡when¡¡you¡¡are¡¡building¡¡debug¡¡mode¡¡or¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡release¡¡mode¡¡code¡£¡¡Debug¡¡mode¡¡means¡¡that¡¡the¡¡code¡¡is¡¡piled¡¡such¡¡that¡¡it¡¡can¡¡be¡¡debugged¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡and¡¡analyzed¡¡using¡¡pretty¡¡symbols¡£¡¡Release¡¡mode¡¡means¡¡when¡¡the¡¡code¡¡is¡¡piled£»¡¡the¡¡code¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡can¡¡still¡¡be¡¡debugged£»¡¡but¡¡the¡¡pretty¡¡symbols¡¡are¡¡missing¡£¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡öNote¡¡¡¡Visual¡¡Basic¡¡Express¡¡does¡¡not¡¡give¡¡you¡¡the¡¡flexibility¡¡to¡¡choose¡¡debug¡¡mode¡¡or¡¡release¡¡mode¡¡for¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡development¡£¡¡To¡¡get¡¡this¡¡feature£»¡¡you¡¡need¡¡the¡¡full¡¡version¡¡of¡¡Visual¡¡Studio¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Think¡¡of¡¡the¡¡pretty¡¡symbols¡¡as¡¡milestones¡¡on¡¡the¡¡road¡£¡¡Every¡¡time¡¡your¡¡code¡¡executes¡¡in¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡debug¡¡mode£»¡¡the¡¡code¡¡is¡¡saying£»¡¡¡°You¡¡are¡¡now¡¡calling¡¡this¡¡method¡¡in¡¡this¡¡source¡¡code¡¡file£»¡±¡¡or¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡°Oops£»¡¡that¡¡property¡¡code¡¡in¡¡the¡¡source¡¡code¡¡file¡¡is¡¡not¡¡working¡¡properly¡£¡±¡¡In¡¡release¡¡mode£»¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡pretty¡¡symbols¡¡are¡¡more¡¡like¡¡road¡¡signs¡¡saying£»¡¡¡°Place¡¡X¡¡y¡¡Miles/Kilometers¡£¡±¡¡The¡¡signs¡¡help¡¡¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡181¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡CH¡¡A¡¡PT¡¡E¡¡R¡¡¡¡¡¡6¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡L¡¡E¡¡A¡¡R¡¡N¡¡I¡¡N¡¡G¡¡¡¡¡¡T¡¡HE¡¡¡¡¡¡B¡¡AS¡¡IC¡¡S¡¡¡¡O¡¡F¡¡¡¡¡¡O¡¡B¡¡J¡¡E¡¡CT¡¡OR¡¡I¡¡E¡¡N¡¡TE¡¡D¡¡¡¡¡¡P¡¡R¡¡O¡¡G¡¡R¡¡AM¡¡M¡¡IN¡¡G¡¡159¡¡



guide¡¡you£»¡¡but¡¡the¡¡information¡¡you¡¡get¡¡from¡¡them¡¡is¡¡very¡¡limited£»¡¡that¡¡is£»¡¡you¡¡don¡¯t¡¡know¡¡which¡¡¡¡

towns¡¡you¡¯re¡¡passing¡£¡¡



More¡¡Property¡¡Scope¡¡Details¡¡



In¡¡this¡¡chapter¡¯s¡¡examples£»¡¡the¡¡Get¡¡and¡¡Set¡¡parts¡¡of¡¡the¡¡properties¡¡always¡¡had¡¡the¡¡same¡¡scope¡£¡¡¡¡

However£»¡¡properties¡¡can¡¡have¡¡mixed¡¡scope£»¡¡that¡¡is£»¡¡the¡¡Get¡¡and¡¡Set¡¡parts¡¡can¡¡have¡¡different¡¡¡¡

scopes¡£¡¡Scope¡¡splitting¡¡works¡¡only¡¡if¡¡you¡¡specify¡¡both¡¡the¡¡Get¡¡and¡¡Set¡¡parts¡¡of¡¡the¡¡property¡£¡¡The¡¡¡¡

idea¡¡behind¡¡splitting¡¡the¡¡scope¡¡is¡¡to¡¡enable¡¡the¡¡implementation¡¡of¡¡the¡¡logic¡¡where¡¡classes¡¡in¡¡the¡¡¡¡

inheritance¡¡chain¡¡are¡¡allowed¡¡to¡¡assign¡¡a¡¡property£»¡¡and¡¡classes¡¡external¡¡to¡¡the¡¡inheritance¡¡¡¡

chain¡¡are¡¡allowed¡¡only¡¡to¡¡read¡¡the¡¡property¡£¡¡The¡¡following¡¡is¡¡an¡¡example¡¡where¡¡a¡¡property¡¡is¡¡¡¡

declared¡¡as¡¡Public¡¡and¡¡the¡¡assignment¡¡of¡¡the¡¡property¡¡is¡¡¡¡Protected¡£¡¡



Class¡¡PropertyScopeExample¡¡

¡¡¡¡¡¡¡¡Private¡¡_value¡¡As¡¡Integer¡¡



¡¡¡¡¡¡¡¡Public¡¡Property¡¡Value£¨£©¡¡As¡¡Integer¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Protected¡¡Set£¨ByVal¡¡value¡¡As¡¡Integer£©¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡_value¡¡=¡¡value¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Set¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Get¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Return¡¡_value¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Get¡¡

¡¡¡¡¡¡¡¡End¡¡Property¡¡

End¡¡Class¡¡



The¡¡MustOverride¡¡Keyword¡¡



In¡¡this¡¡chapter¡¯s¡¡example£»¡¡the¡¡keyword¡¡MustInherit¡¡was¡¡used¡¡to¡¡declare¡¡a¡¡class¡¡that¡¡could¡¡be¡¡¡¡

referenced£»¡¡but¡¡not¡¡instantiated¡£¡¡It¡¡is¡¡also¡¡possible¡¡to¡¡define¡¡methods¡¡that¡¡need¡¡to¡¡be¡¡imple

mented¡£¡¡In¡¡Visual¡¡Basic£»¡¡to¡¡require¡¡a¡¡derived¡¡class¡¡to¡¡implement¡¡the¡¡method£»¡¡you¡¡use¡¡MustOverride¡£¡¡¡¡

The¡¡idea¡¡behind¡¡declaring¡¡methods¡¡that¡¡need¡¡to¡¡be¡¡overridden¡¡is¡¡that¡¡it¡¡allows¡¡a¡¡developer¡¡to¡¡¡¡

define¡¡an¡¡intention¡¡in¡¡a¡¡base¡¡class¡¡that¡¡can¡¡then¡¡be¡¡implemented¡¡in¡¡the¡¡subclass¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡In¡¡the¡¡implementation¡¡of¡¡HotelCurrencyTrader¡¡and¡¡ActiveCurrencyTrader£»¡¡two¡¡methods¡¡¡¡

were¡¡defined£º¡¡ConvertTo£¨£©¡¡and¡¡ConvertFrom£¨£©¡£¡¡A¡¡developer¡¡could¡¡e¡¡to¡¡the¡¡conclusion¡¡that¡¡¡¡

the¡¡methods¡¡are¡¡mon¡¡to¡¡both¡¡classes£»¡¡and¡¡thus¡¡they¡¡could¡¡be¡¡defined¡¡in¡¡the¡¡base¡¡class¡¡¡¡

CurrencyTrader¡£¡¡That¡¡is¡¡not¡¡a¡¡bad¡¡idea¡£¡¡Let¡¯s¡¡revisit¡¡the¡¡CurrencyTrader¡¡class¡¡and¡¡see¡¡how¡¡these¡¡¡¡

two¡¡methods¡¡could¡¡be¡¡added¡¡to¡¡CurrencyTrader¡¡as¡¡MustOverride¡¡methods¡£¡¡



Public¡¡MustInherit¡¡Class¡¡CurrencyTrader¡¡

¡¡¡¡¡¡¡¡Private¡¡_exchangeRate¡¡As¡¡Double¡¡



¡¡¡¡¡¡¡¡Protected¡¡Property¡¡ExchangeRate£¨£©¡¡As¡¡Double¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Get¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Return¡¡_exchangeRate¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Get¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Set¡¡£¨ByVal¡¡Value¡¡As¡¡Double£©¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡_exchangeRate¡¡=¡¡Value¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Set¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡182¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

160¡¡¡¡¡¡¡¡¡¡¡¡¡¡CH¡¡AP¡¡T¡¡E¡¡R¡¡¡¡¡¡6¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡L¡¡E¡¡A¡¡R¡¡N¡¡IN¡¡G¡¡¡¡¡¡T¡¡HE¡¡¡¡¡¡B¡¡AS¡¡IC¡¡S¡¡¡¡O¡¡F¡¡¡¡¡¡OB¡¡J¡¡E¡¡CT¡¡OR¡¡I¡¡E¡¡N¡¡T¡¡E¡¡D¡¡¡¡¡¡P¡¡R¡¡O¡¡G¡¡R¡¡AM¡¡M¡¡IN¡¡G¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Property¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Protected¡¡Function¡¡ConvertValue£¨ByVal¡¡input¡¡As¡¡Double£©¡¡As¡¡Double¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Return¡¡_exchangeRate¡¡*¡¡input¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Function¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Protected¡¡Function¡¡ConvertValueInverse£¨ByVal¡¡input¡¡As¡¡Double£©¡¡As¡¡Double¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Return¡¡input¡¡/¡¡_exchangeRate¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Function¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Public¡¡MustOverride¡¡Function¡¡ConvertTo£¨ByVal¡¡value¡¡As¡¡Double£©¡¡As¡¡Double¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Public¡¡MustOverride¡¡Function¡¡ConvertFrom£¨ByVal¡¡value¡¡As¡¡Double£©¡¡As¡¡Double¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Class¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡A¡¡MustOverride¡¡method¡¡is¡¡declared¡¡without¡¡an¡¡implementation¡£¡¡Any¡¡class¡¡that¡¡subclasses¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡CurrencyTrader¡¡is¡¡required¡¡to¡¡implement¡¡ConvertTo£¨£©¡¡and¡¡ConvertFrom£¨£©¡£¡¡In¡¡the¡¡case¡¡of¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡HotelCurrencyTrader¡¡and¡¡ActiveCurrencyTrader£»¡¡this¡¡is¡¡not¡¡a¡¡problem£»¡¡because¡¡the¡¡methods¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡are¡¡already¡¡implemented¡£¡¡However£»¡¡the¡¡methods¡¡need¡¡to¡¡be¡¡changed¡¡slightly£»¡¡as¡¡follows£º¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Public¡¡Overrides¡¡Function¡¡ConvertTo£¨ByVal¡¡value¡¡As¡¡Double£©¡¡As¡¡Double¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡¡£¡¡¡£¡¡¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Function¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Public¡¡Overrides¡¡Function¡¡ConvertFrom£¨ByVal¡¡value¡¡As¡¡Double£©¡¡As¡¡Double¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡¡£¡¡¡£¡¡¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Function¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡slight¡¡change¡¡is¡¡the¡¡addition¡¡of¡¡the¡¡keyword¡¡Overrides¡¡to¡¡indicate¡¡that¡¡the¡¡ConvertTo£¨£©¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡and¡¡ConvertFrom£¨£©¡¡methods¡¡in¡¡HotelCurrencyTrader¡¡and¡¡ActiveCurrencyTrader¡¡override¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡functionality¡¡in¡¡CurrencyTrader¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡While¡¡you¡¡have¡¡seen¡¡all¡¡of¡¡the¡¡technical¡¡aspects£»¡¡the¡¡bigger¡¡question¡¡is¡¡why¡¡you¡¡would¡¡do¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡this¡¡in¡¡the¡¡first¡¡place¡£¡¡Let¡¯s¡¡go¡¡back¡¡to¡¡the¡¡implementation¡¡of¡¡ActiveCurrencyTrader£»¡¡which¡¡has¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡no¡¡MustOverride¡¡method¡¡implementations¡£¡¡To¡¡use¡¡the¡¡class¡¡and¡¡the¡¡method¡¡ConvertTo£¨£©£»¡¡you¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡would¡¡write¡¡the¡¡following¡¡code¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Dim¡¡cls¡¡As¡¡ActiveCurrencyTrader¡¡=¡¡New¡¡ActiveCurrencyTrader£¨1¡£46£»¡¡¡¨USD¡¨£»¡¡¡¨EUR¡¨£©¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Dim¡¡converted¡¡As¡¡Double¡¡=¡¡cls¡£ConvertTo£¨100¡£0£©¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Imagine¡¡the¡¡situation¡¡where¡¡the¡¡values¡¡to¡¡convert¡¡to¡¡and¡¡from¡¡are¡¡text¡£¡¡To¡¡keep¡¡things¡¡general£»¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡you¡¡would¡¡write¡¡the¡¡following¡¡code¡¡£¨which¡¡takes¡¡the¡¡value¡¡from¡¡a¡¡text¡¡box¡¡in¡¡a¡¡Windows¡¡form£©¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Public¡¡Function¡¡ConvertToTextField£¨ByVal¡¡cls¡¡As¡¡ActiveCurrencyTrader£©¡¡As¡¡Double¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Return¡¡cls¡£ConvertTo£¨Double¡£Parse£¨text1¡£Text£©£©¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Function¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡implementation¡¡of¡¡ConvertToTextField£¨£©¡¡makes¡¡one¡¡major¡¡mistake¡¡in¡¡that¡¡it¡¡assumes¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡that¡¡you¡¡will¡¡always¡¡be¡¡converting¡¡a¡¡currency¡¡using¡¡the¡¡ActiveCurrencyTrader¡¡implementation¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡If¡¡you¡¡wanted¡¡to¡¡use¡¡the¡¡class¡¡HotelCurrencyTrader£»¡¡you¡¡would¡¡need¡¡to¡¡implement¡¡another¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡method¡¡with¡¡a¡¡parameter¡¡of¡¡type¡¡HotelCurrencyTrader¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡This¡¡problem¡¡is¡¡a¡¡classical¡¡polymorphism¡¡issue¡¡and¡¡is¡¡solved¡¡by¡¡using¡¡MustOverride¡¡methods¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¨as¡¡you¡¯ll¡¡see¡¡in¡¡Chapter¡¡7£»¡¡the¡¡Overridable¡¡keyword¡¡also¡¡allows¡¡polymorphism£©¡£¡¡Consider¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡following¡¡rewritten¡¡ConvertToTextField£¨£©¡¡method¡£¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡183¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡CH¡¡A¡¡PT¡¡E¡¡R¡¡¡¡¡¡6¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡L¡¡E¡¡A¡¡R¡¡N¡¡I¡¡N¡¡G¡¡¡¡¡¡T¡¡HE¡¡¡¡¡¡B¡¡AS¡¡IC¡¡S¡¡¡¡O¡¡F¡¡¡¡¡¡O¡¡B¡¡J¡¡E¡¡CT¡¡OR¡¡I¡¡E¡¡N¡¡TE¡¡D¡¡¡¡¡¡P¡¡R¡¡O¡¡G¡¡R¡¡AM¡¡M¡¡IN¡¡G¡¡161¡¡



Public¡¡Function¡¡ConvertToTextField£¨ByVal¡¡cls¡¡As¡¡CurrencyTrader£©¡¡As¡¡Double¡¡

¡¡¡¡¡¡¡¡Return¡¡cls¡£ConvertTo£¨Double¡£Parse£¨text1¡£Text£©£©¡¡

End¡¡Function¡¡



¡¡¡¡¡¡¡¡¡¡This¡¡implementation¡¡of¡¡ConvertToTextField£¨£©¡¡uses¡¡the¡¡CurrencyTrader¡¡base¡¡class£»¡¡and¡¡¡¡

since¡¡ConvertTo£¨£©¡¡and¡¡ConvertFrom£¨£©¡¡are¡¡declared£»¡¡they¡¡can¡¡be¡¡referenced¡£¡¡

¡¡¡¡¡¡¡¡¡¡How¡¡you¡¡call¡¡ConvertToTextField£¨£©¡¡and¡¡how¡¡you¡¡instantiate¡¡HotelCurrencyTrader¡¡or¡¡¡¡

ActiveCurrencyTrader¡¡will¡¡not¡¡be¡¡covered¡¡in¡¡this¡¡chapter£»¡¡because¡¡polymorphism¡¡is¡¡the¡¡subject¡¡¡¡

of¡¡the¡¡next¡¡chapter¡£¡¡Just¡¡keep¡¡what¡¡you¡¯ve¡¡learned¡¡about¡¡the¡¡MustInherit¡¡and¡¡MustOverride¡¡¡¡

keywords¡¡in¡¡mind¡¡as¡¡you¡¡read¡¡that¡¡chapter£»¡¡which¡¡covers¡¡concepts¡¡such¡¡as¡¡interfaces£»¡¡because¡¡¡¡

you¡¡can¡¡do¡¡the¡¡same¡¡types¡¡of¡¡things¡¡with¡¡them¡£¡¡¡¡



The¡¡Important¡¡Stuff¡¡to¡¡Remember¡¡



In¡¡this¡¡chapter£»¡¡you¡¡learned¡¡some¡¡of¡¡the¡¡basics¡¡of¡¡object¡­oriented¡¡programming¡£¡¡Here¡¡are¡¡the¡¡¡¡

key¡¡points¡¡to¡¡remember£º¡¡



¡¡¡¡¡¡¡¡¡¡o¡¡¡¡Your¡¡code¡¡will¡¡be¡¡posed¡¡of¡¡structural¡¡£¨or¡¡base¡¡class¡¡functionality£©¡¡and¡¡architectural¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡business¡­related¡¡functionality¡£¡¡



¡¡¡¡¡¡¡¡¡¡o¡¡¡¡Base¡¡class¡¡functionality¡¡is¡¡focused¡¡on¡¡a¡¡particular¡¡problem¡£¡¡Base¡¡class¡¡functionality¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡requires¡¡specific¡¡knowledge¡¡of¡¡the¡¡field¡£¡¡Think¡¡of¡¡it¡¡as¡¡implementing¡¡a¡¡calculator¡¡where¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡your¡¡main¡¡concern¡¡is¡¡ensuring¡¡that¡¡the¡¡calculations¡¡are¡¡correct¡£¡¡



¡¡¡¡¡¡¡¡¡¡o¡¡¡¡Architectural¡¡business¡­related¡¡functionality¡¡is¡¡higher¡­level¡¡functionality¡¡where¡¡general¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡business¡¡knowledge¡¡is¡¡needed¡£¡¡The¡¡idea¡¡is¡¡to¡¡take¡¡the¡¡base¡¡classes¡¡and¡¡use¡¡them¡¡to¡¡solve¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡a¡¡business¡¡problem¡£¡¡Think¡¡of¡¡it¡¡as¡¡using¡¡a¡¡calculator¡¡and¡¡your¡¡main¡¡concern¡¡is¡¡getting¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡the¡¡results¡¡of¡¡the¡¡calculations¡£¡¡



¡¡¡¡¡¡¡¡¡¡o¡¡¡¡Properties¡¡should¡¡be¡¡used¡¡instead¡¡of¡¡exposing¡¡data¡¡members¡¡publicly¡£¡¡



¡¡¡¡¡¡¡¡¡¡o¡¡¡¡Many¡¡developers¡¡dislike¡¡properties¡¡because¡¡they¡¡promote¡¡bad¡¡programming¡¡practices¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡You¡¡need¡¡to¡¡get¡¡beyond¡¡those¡¡ments¡¡and¡¡think¡¡in¡¡terms¡¡of¡¡the¡¡credit¡¡card¡¡and¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡cashier¡£¡¡Properties¡¡have¡¡their¡¡time¡¡and¡¡place¡£¡¡



¡¡¡¡¡¡¡¡¡¡o¡¡¡¡Classes¡¡should£»¡¡in¡¡general£»¡¡not¡¡expose¡¡their¡¡state¡£¡¡To¡¡get¡¡around¡¡exposing¡¡state£»¡¡create¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡methods¡¡that¡¡implement¡¡the¡¡general¡¡intent¡¡of¡¡the¡¡purpose¡¡of¡¡the¡¡class¡£¡¡



¡¡¡¡¡¡¡¡¡¡o¡¡¡¡Inheritance¡¡is¡¡a¡¡fundamental¡¡part¡¡of¡¡Visual¡¡Basic¡¡and¡¡you¡¡will¡¡need¡¡to¡¡know¡¡how¡¡to¡¡use¡¡it¡£¡¡¡¡



¡¡¡¡¡¡¡¡¡¡o¡¡¡¡Overriding¡¡is¡¡when¡¡you¡¡keep¡¡the¡¡interface¡¡the¡¡same¡¡and¡¡change¡¡behavior¡£¡¡¡¡



¡¡¡¡¡¡¡¡¡¡o¡¡¡¡Overloading¡¡is¡¡when¡¡you¡¡derive¡¡a¡¡class¡¡and¡¡define¡¡an¡¡identifier¡¡that¡¡happens¡¡to¡¡be¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡same¡¡as¡¡some¡¡base¡¡class¡¡identifier¡£¡¡Your¡¡overloaded¡¡identifier¡¡may¡¡change¡¡behavior¡¡and¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡usage¡£¡¡



¡¡¡¡¡¡¡¡¡¡o¡¡¡¡Conditional¡¡pilation¡¡statements¡¡can¡¡be¡¡effective¡¡when¡¡you¡¡want¡¡to¡¡include¡¡code¡¡in¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡certain¡¡configurations¡£¡¡



¡¡¡¡¡¡¡¡¡¡o¡¡¡¡Partial¡¡classes¡¡are¡¡very¡¡useful¡¡when¡¡you¡¡want¡¡to¡¡separate¡¡functionality¡¡that¡¡serves¡¡a¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡specific¡¡purpose¡£¡¡In¡¡this¡¡chapter¡¯s¡¡example£»¡¡it¡¡meant¡¡having¡¡the¡¡ability¡¡to¡¡add¡¡test¡¡code¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡without¡¡violating¡¡the¡¡rule¡¡of¡¡exposing¡¡state¡£¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡184¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

162¡¡¡¡¡¡¡¡¡¡¡¡¡¡CH¡¡AP¡¡T¡¡E¡¡R¡¡¡¡¡¡6¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡L¡¡E¡¡A¡¡R¡¡N¡¡IN¡¡G¡¡¡¡¡¡T¡¡HE¡¡¡¡¡¡B¡¡AS¡¡IC¡¡S¡¡¡¡O¡¡F¡¡¡¡¡¡OB¡¡J¡¡E¡¡CT¡¡OR¡¡I¡¡E¡¡N¡¡T¡¡E¡¡D¡¡¡¡¡¡P¡¡R¡¡O¡¡G¡¡R¡¡AM¡¡M¡¡IN¡¡G¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Some¡¡Things¡¡for¡¡You¡¡to¡¡Do¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡To¡¡apply¡¡what¡¡you¡¯ve¡¡learned¡¡in¡¡this¡¡chapter£»¡¡you¡¡can¡¡do¡¡the¡¡following¡¡exercises¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡1¡£¡¡The¡¡code¡¡for¡¡HotelCurrencyTrader¡£ConvertTo£¨£©¡¡and¡¡HotelCurrencyTrader¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ConvertFrom£¨£©¡¡contains¡¡a¡¡potentially¡¡big¡¡bug¡£¡¡Identify¡¡the¡¡bug¡¡and¡¡fix¡¡it¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2¡£¡¡In¡¡the¡¡examples£»¡¡the¡¡exchange¡¡rate¡¡is¡¡assigned¡¡by¡¡the¡¡caller¡¡of¡¡the¡¡HotelCurrencyTrader¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡and¡¡ActiveCurrencyTrader¡£¡¡Implement¡¡functionality¡¡such¡¡that¡¡the¡¡exchange¡¡rate¡¡can¡¡be¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡retrieved¡¡dynamically¡£¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡3¡£¡¡The¡¡currency¡¡ExchangeRate¡¡property¡¡is¡¡a¡¡Double¡£¡¡Implement¡¡ExchangeRate¡¡using¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Decimal¡¡type¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡4¡£¡¡Write¡¡test¡¡code¡¡for¡¡ActiveCurrencyTrader¡¡and¡¡HotelCurrencyTrader¡£¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡185¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

C¡¡¡¡H¡¡¡¡A¡¡¡¡P¡¡¡¡T¡¡¡¡E¡¡¡¡R¡¡¡¡¡¡¡¡¡¡7¡¡



¡ö¡¡¡ö¡¡¡ö¡¡



Learning¡¡About¡¡ponents¡¡¡¡

and¡¡Class¡¡Hierarchies¡¡



The¡¡previous¡¡chapter¡¡covered¡¡the¡¡basics¡¡of¡¡object¡­oriented¡¡programming¡£¡¡You¡¡learned¡¡how¡¡¡¡

one¡¡class¡¡can¡¡subclass¡¡another¡¡class£»¡¡thus¡¡building¡¡a¡¡hierarchy¡£¡¡Using¡¡a¡¡class¡¡hierarchy£»¡¡classes¡¡¡¡

can¡¡share¡¡functionality¡£¡¡

¡¡¡¡¡¡¡¡¡¡This¡¡chapter¡¡will¡¡focus¡¡on¡¡the¡¡details¡¡of¡¡class¡¡hierarchies£»¡¡including¡¡how¡¡to¡¡extend¡¡them¡¡so¡¡¡¡

that¡¡derived¡¡classes¡¡can¡¡specialize¡¡shared¡¡functionality¡£¡¡To¡¡demonstrate¡¡these¡¡concepts£»¡¡we¡¡will¡¡¡¡

build¡¡a¡¡tax¡¡application¡£¡¡This¡¡type¡¡of¡¡application¡¡is¡¡a¡¡good¡¡example¡¡of¡¡using¡¡class¡¡hierarchies£»¡¡¡¡

because¡¡the¡¡general¡¡idea¡¡of¡¡paying¡¡taxes¡¡is¡¡identical£»¡¡regardless¡¡of¡¡the¡¡country£»¡¡but¡¡the¡¡details¡¡¡¡

are¡¡different¡£¡¡

¡¡¡¡¡¡¡¡¡¡From¡¡a¡¡technical¡¡perspective£»¡¡we¡¯ll¡¡cover¡¡the¡¡following¡¡topics£º¡¡



¡¡¡¡¡¡¡¡o¡¡¡¡Interfaces£»¡¡which¡¡are¡¡the¡¡basis¡¡of¡¡software¡¡ponents¡¡



¡¡¡¡¡¡¡¡o¡¡¡¡Details¡¡of¡¡overloading¡¡and¡¡overriding¡¡methods¡¡



¡¡¡¡¡¡¡¡o¡¡¡¡How¡¡and¡¡when¡¡to¡¡use¡¡factories¡¡



¡¡¡¡¡¡¡¡¡¡We¡¯ll¡¡begin¡¡with¡¡some¡¡basic¡¡tax¡¡concepts¡¡that¡¡relate¡¡to¡¡our¡¡sample¡¡application¡£¡¡



Understanding¡¡Some¡¡Basic¡¡Tax¡¡Concepts¡¡



Taxes¡¡and¡¡death¡¡are¡¡two¡¡sure¡¡things¡¡in¡¡life¡£¡¡Regardless¡¡of¡¡where¡¡you¡¡live£»¡¡the¡¡government¡¡has¡¡¡¡

managed¡¡to¡¡create¡¡a¡¡system¡¡where¡¡you¡¡pay¡¡taxes¡¡£¨for¡¡the¡¡good¡¡of¡¡the¡¡people£»¡¡of¡¡course£©¡£¡¡As¡¡a¡¡¡¡

result£»¡¡people¡¡hate¡¡paying¡¡taxes£»¡¡and¡¡many¡¡figure¡¡out¡¡creative¡¡ways¡¡to¡¡not¡¡pay¡¡taxes¡£¡¡Honest¡¡people¡¡¡¡

who¡¡would¡¡normally¡¡not¡¡break¡¡the¡¡law¡¡find¡¡clever¡¡ways¡¡of¡¡bending¡¡the¡¡rules¡¡in¡¡their¡¡favor¡£¡¡In¡¡¡¡

some¡¡countries£»¡¡they¡¡even¡¡expect¡¡that¡¡you¡¡will¡¡cheat£»¡¡and¡¡will¡¡calculate¡¡your¡¡¡°true¡±¡¡tax¡¡figure¡£¡¡

¡¡¡¡¡¡¡¡¡¡Taxes¡¡seem¡¡like¡¡a¡¡plex¡¡topic£»¡¡but¡¡they¡¡are¡¡rather¡¡simple¡£¡¡The¡¡volumes¡¡of¡¡rules¡¡associ

ated¡¡with¡¡taxes¡¡are¡¡what¡¡make¡¡them¡¡plicated¡£¡¡Taxes¡¡boil¡¡down¡¡to¡¡the¡¡fact¡¡that¡¡if¡¡you¡¡buy¡¡or¡¡¡¡

do¡¡X£»¡¡then¡¡you¡¡can¡¡deduct¡¡or¡¡charge¡¡Y¡£¡¡Sometimes£»¡¡the¡¡taxes¡¡make¡¡sense£»¡¡sometimes¡¡they¡¡don¡¯t¡£¡¡¡¡

Overall¡¡though£»¡¡the¡¡tax¡¡rules¡¡are¡¡similar¡¡in¡¡logic£»¡¡and¡¡that¡¡means¡¡a¡¡hierarchy¡¡of¡¡classes¡¡can¡¡¡¡

be¡¡designed¡£¡¡

¡¡¡¡¡¡¡¡¡¡Taxable¡¡ine¡¡is¡¡the¡¡sum¡¡of¡¡monies¡¡that¡¡you¡¡earned¡¡for¡¡which¡¡a¡¡tax¡¡rate¡¡is¡¡applied¡£¡¡The¡¡¡¡

taxable¡¡ine¡¡may¡¡or¡¡may¡¡not¡¡be¡¡equal¡¡to¡¡the¡¡sum¡¡of¡¡money¡¡that¡¡you¡¡earned¡¡during¡¡a¡¡year¡£¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡163¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡186¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

164¡¡¡¡¡¡¡¡¡¡¡¡¡¡CH¡¡AP¡¡T¡¡E¡¡R¡¡¡¡¡¡7¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡L¡¡E¡¡A¡¡R¡¡N¡¡IN¡¡G¡¡¡¡¡¡AB¡¡OU¡¡T¡¡¡¡¡¡CO¡¡M¡¡P¡¡O¡¡N¡¡E¡¡N¡¡TS¡¡¡¡¡¡AN¡¡D¡¡¡¡C¡¡L¡¡AS¡¡S¡¡¡¡H¡¡I¡¡E¡¡R¡¡AR¡¡C¡¡H¡¡IE¡¡S¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Taxable¡¡ine¡¡can¡¡be¡¡less¡¡due¡¡to¡¡deductions¡¡and¡¡ine¡¡deferment¡£¡¡And¡¡in¡¡some¡¡cases£»¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡taxable¡¡ine¡¡can¡¡be¡¡more¡¡due¡¡to¡¡deferment¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Deductions¡¡are¡¡items¡¡that¡¡can¡¡be¡¡charged¡¡against¡¡taxable¡¡ine¡£¡¡People¡¡mistakenly¡¡believe¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡that¡¡deductions¡¡can¡¡be¡¡charged¡¡directly¡¡against¡¡the¡¡tax¡¡payable¡¡amount¡£¡¡Or¡¡they¡¡mistakenly¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡believe¡¡a¡¡tax¡¡deduction¡¡is¡¡always¡¡an¡¡advantage¡£¡¡For¡¡example£»¡¡let¡¯s¡¡say¡¡you¡¡have¡¡1£»000¡¡of¡¡tax¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡deductions¡£¡¡If¡¡your¡¡ine¡¡is¡¡2£»000£»000£»¡¡then¡¡the¡¡deduction¡¡is¡¡not¡¡worth¡¡much£»¡¡since¡¡your¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡taxable¡¡ine¡¡is¡¡still¡¡1£»999£»000¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Partial¡¡taxation¡¡is¡¡when¡¡a¡¡partial¡¡amount¡¡of¡¡earned¡¡monies¡¡is¡¡added¡¡to¡¡the¡¡total¡¡taxable¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ine¡£¡¡Often£»¡¡partial¡¡taxation¡¡is¡¡applied¡¡to¡¡capital¡¡gains¡£¡¡¡¡Capital¡¡gains¡¡refer¡¡to¡¡when¡¡you¡¡have¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡bought¡¡something¡¡like¡¡a¡¡property¡¡and¡¡then¡¡sold¡¡it¡¡at¡¡a¡¡higher¡¡price¡¡than¡¡you¡¡paid¡¡for¡¡it¡£¡¡The¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡diffe
·µ»ØĿ¼ ÉÏÒ»Ò³ ÏÂÒ»Ò³ »Øµ½¶¥²¿ ÔÞ£¨11£© ²È£¨11£©
¿ì½Ý²Ù×÷: °´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·­Ò³ °´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ °´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿!
ÎÂÜ°Ìáʾ£º ο´Ð¡ËµµÄͬʱ·¢±íÆÀÂÛ£¬Ëµ³ö×Ô¼ºµÄ¿´·¨ºÍÆäËüС»ï°éÃÇ·ÖÏíÒ²²»´íŶ£¡·¢±íÊéÆÀ»¹¿ÉÒÔ»ñµÃ»ý·ÖºÍ¾­Ñé½±Àø£¬ÈÏÕæдԭ´´ÊéÆÀ ±»²ÉÄÉΪ¾«ÆÀ¿ÉÒÔ»ñµÃ´óÁ¿½ð±Ò¡¢»ý·ÖºÍ¾­Ñé½±ÀøŶ£¡