Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A *x = new B;
- delete x; // ~B() called, even though x has type A*
- class MutexLock {
- mutex *mtx_;
- public:
- explicit MutexLock(mutex *mtx) : mtx_(mtx) { mtx_->lock(); }
- ~MutexLock() { mtx_->unlock(); }
- private:
- MutexLock(const MutexLock &rhs);
- MutexLock &operator=(const MutexLock &rhs);
- };
Add Comment
Please, Sign In to add comment