From 029688e143109344989b1529259e391822abb0aa Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Sun, 21 Jul 2019 03:21:00 +0700 Subject: [cpptour] Learn the basis --- cpptour/Vector-test.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 cpptour/Vector-test.cc (limited to 'cpptour/Vector-test.cc') diff --git a/cpptour/Vector-test.cc b/cpptour/Vector-test.cc new file mode 100644 index 0000000..b49ff85 --- /dev/null +++ b/cpptour/Vector-test.cc @@ -0,0 +1,20 @@ +#include +#include + +#include "Vector.h" + +using namespace std; + +void +neg_length () +{ + try { Vector v (-27); } + catch (length_error) { cout << "it's alright" << endl; } + catch (bad_alloc) { cout << "BIG OOF!" << endl; } +} + +int +main () +{ + neg_length (); +} -- cgit 1.4.1