mirror of
https://github.com/github/codeql.git
synced 2025-12-19 10:23:15 +01:00
48 lines
586 B
C++
48 lines
586 B
C++
|
|
class MyInt
|
|
{
|
|
public:
|
|
MyInt(int _value) : value(_value) {};
|
|
|
|
MyInt operator+(const MyInt &rhs)
|
|
{
|
|
return MyInt(value + rhs.value);
|
|
}
|
|
|
|
MyInt &operator+=(const MyInt &rhs)
|
|
{
|
|
value += rhs.value;
|
|
return *this;
|
|
}
|
|
|
|
MyInt &operator++() // ++x
|
|
{
|
|
value++;
|
|
return *this;
|
|
}
|
|
|
|
MyInt operator++(int) // x++
|
|
{
|
|
MyInt result(value);
|
|
value++;
|
|
return result;
|
|
}
|
|
|
|
MyInt &operator>>=(int amount)
|
|
{
|
|
value >>= amount;
|
|
return *this;
|
|
}
|
|
|
|
int value;
|
|
};
|
|
|
|
void test(MyInt a, MyInt b)
|
|
{
|
|
MyInt c = a + b;
|
|
c += b;
|
|
++c;
|
|
c++;
|
|
c >>= 4;
|
|
}
|