diff options
Diffstat (limited to 'tests/libsample/abstract.cpp')
-rw-r--r-- | tests/libsample/abstract.cpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/libsample/abstract.cpp b/tests/libsample/abstract.cpp new file mode 100644 index 000000000..8b49f37f8 --- /dev/null +++ b/tests/libsample/abstract.cpp @@ -0,0 +1,64 @@ +#include <iostream> +#include "abstract.h" + +using namespace std; + +Abstract::Abstract(int id) : m_id(id) +{ + cout << __PRETTY_FUNCTION__; + show(); + cout << endl; +} + +Abstract::~Abstract() +{ + cout << __PRETTY_FUNCTION__; + show(); + cout << endl; +} + +void +Abstract::unpureVirtual() +{ + cout << __PRETTY_FUNCTION__ << endl; +} + +void +Abstract::callUnpureVirtual() +{ + cout << __PRETTY_FUNCTION__ << " --- BEGIN" << endl; + this->unpureVirtual(); + cout << __PRETTY_FUNCTION__ << " --- END" << endl; +} + + +void +Abstract::callPureVirtual() +{ + cout << __PRETTY_FUNCTION__ << " --- BEGIN" << endl; + this->pureVirtual(); + cout << __PRETTY_FUNCTION__ << " --- END" << endl; +} + +void +Abstract::show(PrintFormat format) +{ + cout << '<'; + switch(format) { + case Short: + cout << this; + break; + case Verbose: + cout << "class " << className() << " | cptr: " << this; + cout << ", id: " << m_id; + break; + case OnlyId: + cout << "id: " << m_id; + break; + case ClassNameAndId: + cout << className() << " - id: " << m_id; + break; + } + cout << '>'; +} + |