aboutsummaryrefslogtreecommitdiffstats
path: root/tests/libsample/derived.h
blob: 5efc7c4b4a06f1b76681f1c73f2c2b5455d5fe29 (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
#ifndef DERIVED_H
#define DERIVED_H

#include "abstract.h"

enum PolymorphicFuncEnum {
    PolymorphicFunc_ii,
    PolymorphicFunc_d
};

class Derived : public Abstract
{
public:
    enum OtherPolymorphicFuncEnum {
        OtherPolymorphicFunc_iibd,
        OtherPolymorphicFunc_id
    };

    Derived(int id = -1);
    virtual ~Derived();
    virtual void pureVirtual();
    virtual void unpureVirtual();

    // factory method
    static Abstract* createObject();

    // single argument
    bool singleArgument(bool b);

    // method with default value
    double defaultValue(int n = 0);

    // overloads
    PolymorphicFuncEnum polymorphic(int i = 0, int d = 0);
    PolymorphicFuncEnum polymorphic(double n);

    // more overloads
    OtherPolymorphicFuncEnum otherPolymorphic(int a, int b, bool c, double d);
    OtherPolymorphicFuncEnum otherPolymorphic(int a, double b);

protected:
    const char* getClassName() { return className(); }
    virtual const char* className() { return "Derived"; }
};
#endif // DERIVED_H