30.06.2013 Aufrufe

Softwareentwicklung in C++ - ASC

Softwareentwicklung in C++ - ASC

Softwareentwicklung in C++ - ASC

MEHR ANZEIGEN
WENIGER ANZEIGEN

Erfolgreiche ePaper selbst erstellen

Machen Sie aus Ihren PDF Publikationen ein blätterbares Flipbook mit unserer einzigartigen Google optimierten e-Paper Software.

42<br />

15.3 Funktionspo<strong>in</strong>ter 473<br />

43 //−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

44 virtual u<strong>in</strong>t32 anotherCalculatorMethod ( u<strong>in</strong>t32 val )<br />

45 {<br />

46 return ( val + o f f s e t ) ;<br />

47 }<br />

48 } ;<br />

49<br />

50 //−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

51 /∗<br />

52 ∗ AnotherCalcMethodCollection<br />

53 ∗<br />

54 ∗ j u s t a demo f o r polymorphism<br />

55 ∗<br />

56 ∗/<br />

57<br />

58 class AnotherCalcMethodCollection : public CalcMethodCollection<br />

59 {<br />

60 public :<br />

61 AnotherCalcMethodCollection ( u<strong>in</strong>t32 m u l t i p l i c a t o r , u<strong>in</strong>t32 o f f s e t )<br />

62 throw ( ) : CalcMethodCollection ( m u l t i p l i c a t o r , o f f s e t ) {}<br />

63<br />

64 virtual ˜ AnotherCalcMethodCollection ( )<br />

65 throw( ) { }<br />

66<br />

67 //−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

68 virtual u<strong>in</strong>t32 anotherCalculatorMethod ( u<strong>in</strong>t32 val )<br />

69 {<br />

70 return ( val + ( 2 ∗ o f f s e t ) ) ;<br />

71 }<br />

72 } ;<br />

73<br />

74<br />

75 //−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

76 <strong>in</strong>t ma<strong>in</strong> ( <strong>in</strong>t argc , char ∗ argv [ ] )<br />

77 {<br />

78 u<strong>in</strong>t32 ( CalcMethodCollection : : ∗ calcFunction ) ( u<strong>in</strong>t32 ) ;<br />

79<br />

80 CalcMethodCollection method collection1 ( 2 , 7 ) ;<br />

81 AnotherCalcMethodCollection method collection2 ( 2 , 7 ) ;<br />

82<br />

83 calcFunction = &CalcMethodCollection : : aCalculatorMethod ;<br />

84 cout

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!