summaryrefslogtreecommitdiff
path: root/Examples/php/sync/example.cxx
blob: 2001a5b4e9f32e900f5c9dfd7e7bb3bd6a0572e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "example.h"
#include <iostream>

int x = 42;
std::string s = "Test";

void Sync::printer() {
    std::cout << "The value of global s is " << ::s << '\n';
    std::cout << "The value of global x is " << ::x << '\n';
    std::cout << "The value of class s is " << this->s << '\n';
    std::cout << "The value of class x is " << this->x << '\n';
}

void Sync::all_change() {
    ::s = "global change";
    ++::x;
    this->s = "local change";
    ++this->x;
}