summaryrefslogtreecommitdiff
path: root/test/test07.cpp
blob: dad8a188b33de198a485a6ad03464a2459eaba9f (plain) (blame)
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
65
#include <string>
#include <vector>

struct Struct1
{
    Struct1() :
        str(),
        num(0)
    {
    }

    std::string str;
    int num;
};

class Object1
{
    int k;
    std::vector<Struct1*> vec1;

    void func1()
    {
    }

    void func2(int *aptr)
    {
        *aptr = 0;
    }

    void func3(int *aptr)
    {
        if (aptr)
            *aptr = 0;
    }

    void func4(int *aptr)
    {
        k = 3;
    }

    void func5(Struct1 *sptr)
    {
        sptr->num = 0;
    }

    void func6(Struct1 *sptr)
    {
        if (!sptr)
            return;
        sptr->num = 0;
    }

    void func7(Struct1 *const sptr)
    {
        if (!sptr)
            return;
        vec1.push_back(sptr);
    }

    void func8(Struct1 *sptr)
    {
        k = 10;
        this->k = 20;
    }
};