cpp:function_try_blocks
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
cpp:function_try_blocks [2019/05/06 15:12] – [Function Try Blocks] gthanos | cpp:function_try_blocks [2019/05/06 15:16] – [Exception που συμβαίνουν στον κατασκευαστή προγόνου κλάσης] gthanos | ||
---|---|---|---|
Line 149: | Line 149: | ||
<code cpp Student.hpp> | <code cpp Student.hpp> | ||
- | Student:: | + | class Student: public Person { |
+ | int aem; | ||
+ | public: | ||
+ | Student(const char *first, const char *last, int id); | ||
+ | }; | ||
+ | |||
+ | Student:: | ||
cout << " | cout << " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Εάν επιθυμούμε να " | ||
+ | <code cpp> | ||
+ | class Student: public Person { | ||
+ | int aem; | ||
+ | public: | ||
+ | Student(const char *first, const char *last, int id); | ||
+ | }; | ||
+ | |||
+ | Student:: | ||
+ | cout << " | ||
+ | } | ||
+ | catch(BadName& | ||
+ | cout << " | ||
+ | delete firstname; | ||
} | } | ||
</ | </ | ||
+ | |||
+ | Η παραπάνω σύνταξη επιτρέπει να πιάσουμε το exception που συνέβει στον κατασκευαστή της προγόνου κλάσης. Και εδώ το // | ||
cpp/function_try_blocks.txt · Last modified: 2022/05/23 06:05 by gthanos