Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
teaching
nprg041
Šmelko
CZ Cvičenia z Cpp
Commits
60cd82b9
Commit
60cd82b9
authored
Dec 08, 2021
by
Šmelko Adam Mgr.
Browse files
cv10
parent
3822be02
Changes
3
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
60cd82b9
...
...
@@ -32,6 +32,7 @@ Deadliny:
| 18.11.2021 | Polymorfní datové struktury |
[
CV7
](
https://gitlab.mff.cuni.cz/teaching/nprg041/Smelko/cpp-cvika/-/blob/master/prezentacie/Cv7.pdf
)
|
| 25.11.2021 | Šablony |
[
CV8
](
https://gitlab.mff.cuni.cz/teaching/nprg041/Smelko/cpp-cvika/-/blob/master/prezentacie/Cv8.pdf
)
|
| 02.12.2021 | Gumové pole, 2. DÚ |
[
CV9
](
https://gitlab.mff.cuni.cz/teaching/nprg041/Smelko/cpp-cvika/-/blob/master/prezentacie/Cv9.pdf
)
|
| 09.12.2021 | Výjimky, streamy a manipulátory |
[
CV10
](
https://gitlab.mff.cuni.cz/teaching/nprg041/Smelko/cpp-cvika/-/blob/master/prezentacie/Cv10.pdf
)
|
## Úkoly:
...
...
prezentacie/Cv10.pdf
0 → 100644
View file @
60cd82b9
File added
vzorove-priklady/exception.cpp
0 → 100644
View file @
60cd82b9
#include <stdexcept>
#include <iostream>
struct
X
{
~
X
()
{
std
::
cout
<<
"X destructed"
<<
std
::
endl
;}
};
struct
Y
{
~
Y
()
{
std
::
cout
<<
"Y destructed"
<<
std
::
endl
;}
};
void
g
()
{
Y
y
;
throw
std
::
runtime_error
(
"e"
);
}
void
f
()
{
X
x
;
g
();
X
x2
;
}
int
main
()
{
try
{
f
();
}
catch
(
std
::
runtime_error
&
e
)
{
std
::
cout
<<
"caught std::runtime_error"
<<
std
::
endl
;
}
catch
(
std
::
exception
&
e
)
{
std
::
cout
<<
"caught std::exception"
<<
std
::
endl
;
}
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment