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 a s t r u c t . a member = 17;<br />

43 a s t r u c t . another member = 20;<br />

44<br />

45 show ( a s t r u c t ) ;<br />

46<br />

6.1 References 111<br />

47 // assignment of r e f e r e n c e i s f a s t e r than copy<strong>in</strong>g s t r u c t<br />

48 struct TestStruct & a s s i g n e d s t r u c t = a s t r u c t ;<br />

49<br />

50 // t h i s assignment i s ok<br />

51 const struct TestStruct & c o n s t s t r u c t r e f = a s t r u c t ;<br />

52<br />

53 // t h i s one r e s u l t s <strong>in</strong> a compiler e r r o r<br />

54 struct TestStruct & a n o t h e r s t r u c t r e f = c o n s t s t r u c t r e f ;<br />

55<br />

56 return ( 0 ) ;<br />

57 }<br />

58<br />

59 //−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

60 void show ( const struct TestStruct & t h e s t r u c t )<br />

61 {<br />

62 struct TestStruct &bad hack =<br />

63 const cast(t h e s t r u c t ) ;<br />

64<br />

65 bad hack . a member = 3;<br />

66<br />

67 cout

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

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!