mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
32 lines
400 B
C++
32 lines
400 B
C++
|
|
class MyValue
|
|
{
|
|
public:
|
|
MyValue(int _v) : v(_v) {};
|
|
MyValue(const MyValue &other) : v(other.v) {};
|
|
|
|
MyValue &operator=(const MyValue &other)
|
|
{
|
|
v = other.v;
|
|
|
|
return *this;
|
|
}
|
|
|
|
MyValue operator*() // overload operator* to function as increment
|
|
{
|
|
MyValue temp(*this);
|
|
v++;
|
|
return temp;
|
|
}
|
|
|
|
int v;
|
|
};
|
|
|
|
void overload_test1()
|
|
{
|
|
MyValue x(1), y = x;
|
|
MyValue z(MyValue(x));
|
|
|
|
y = ***x;
|
|
}
|