aboutsummaryrefslogtreecommitdiffstats
path: root/tests/libsample/abstract.cpp
blob: 39ac0fdbaa4bead53a5aa17fb66e99f36f10c681 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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 << '>';
}