05.11.2013 Aufrufe

Vergleich von Delphi und Visual C++ - Inhalt

Vergleich von Delphi und Visual C++ - Inhalt

Vergleich von Delphi und Visual C++ - Inhalt

MEHR ANZEIGEN
WENIGER ANZEIGEN

Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.

YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.

<strong>Vergleich</strong> <strong>von</strong> <strong>Delphi</strong> <strong>und</strong> <strong>Visual</strong> <strong>C++</strong> - Kapitel 2B<br />

5<br />

Ausnahme-<br />

auslöse-<br />

Anweisung<br />

(raise exception)<br />

void IsInside(int Wert,<br />

int Min,<br />

int Max)<br />

{<br />

if ((Wert < Min) ||<br />

(Wert > Max))<br />

throw "Wert außerhalb";<br />

}<br />

···<br />

int i;<br />

i = 15;<br />

try<br />

{<br />

IsInside(i, 1, 10);<br />

}<br />

catch(char* str)<br />

{<br />

printf("Exception %s<br />

aufgetreten", str);<br />

}<br />

procedure IsInside(Wert,<br />

Min,<br />

Max: Integer);<br />

begin<br />

if (Wert < Min) or<br />

(Wert > Max) then<br />

raise ERangeError.<br />

Create('Wert<br />

außerhalb');<br />

end;<br />

···<br />

var i: Integer;<br />

i:= 15;<br />

try<br />

IsInside(i, 1, 10);<br />

except<br />

on E: ERangeError do<br />

write('Exception '+<br />

E.Message +<br />

'aufgetreten');<br />

end;<br />

5<br />

Ausnahme- Ende-<br />

Behandlung<br />

(termination handling)<br />

__try<br />

{<br />

;<br />

}<br />

__finally<br />

{<br />

;<br />

}<br />

try<br />

;<br />

finally<br />

;<br />

end;<br />

http://ourworld.compuserve.com/homepages/praxisservice/kapit2b.htm (32 of 52) [19.05.2000 15:30:09]

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

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!