Skip to content

Instantly share code, notes, and snippets.

@bphucc
Created November 13, 2021 10:11
Show Gist options
  • Select an option

  • Save bphucc/ff2acf19cf9554d6f5300490ce0e8353 to your computer and use it in GitHub Desktop.

Select an option

Save bphucc/ff2acf19cf9554d6f5300490ce0e8353 to your computer and use it in GitHub Desktop.
#include <iostream>
class Ulong {
private:
long long value;
public:
Ulong(long long x) : value(x){}
~Ulong(){}
friend bool operator ==(const Ulong x1, const Ulong x2){
return x1.value == x2.value;
}
friend std::ostream &operator <<(std::ostream &os, Ulong obj){
os << obj.value << std::endl;
return os;
}
};
void sosanh(Ulong x1, Ulong x2){
std::string out = (x1 == x2) ? "True" : "False";
std::cout << out << std::endl;
}
int main(){
Ulong obj(1024), obj1(9981), obj3(1024);
sosanh(obj1, obj);
sosanh(obj, obj3);
std::cout << obj << obj1 << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment