Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "Rectangle.h"
- namespace Shape {
- class NemFerBele : public std::exception {
- const char *what() const throw() {
- return "Nem fér bele a négyzet";
- }
- };
- template<class T>
- void fit(T &a, T &b) {
- if (a < b) {
- std::cout << "Belefer";
- } else {
- throw NemFerBele();
- }
- }
- }
- int main() {
- Shape::Rectangle square(10.0, 10.0);
- Shape::Rectangle square2(11.0, 9.0);
- try {
- Shape::fit(square, square2);
- } catch (std::exception &e) {
- std::cout << e.what() << std::endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement