s RangeError {}; // класс искл
Автор admin Воскресенье, 3 мая 2009 11:32
s RangeError {}; // класс исключения PWrapO { ptr = new T[sz]; cout « “PWrap constructor” « endl; } -PWrapO { delete [] ptr; cout « “PWrap destructor” « endl: } T& operator[](int i) throw(RangeError) { if(i >= 0 && i < sz) return ptr[i]; throw RangeError(); } }: class Cat { public: CatO { cout « "CatO" « endl: } -CatO { cout « "-CatO" « endl: } void gO {} }: class Dog { public: void* operator new[](size_t) { cout « "Allocating a Dog" « endl; throw 47; } void operator delete[](void* p) { cout « "Deallocating a Dog" « endl: :operator delete[](p): } }: class UseResources { PWrap
Комментарии закрыты.
Последние комментарии