Shows how to use xtd::iequatable interface.
#include <xtd/console>
#include <xtd/iequatable>
public:
explicit foo(int value) : value_ {value} {}
bool equals(const foo& value) const noexcept override {return value_ == value.value_;}
private:
int value_ = 0;
};
auto main() -> int {
console::write_line("foo {{42}}.equals(foo {{42}}) = {}", foo {42}.equals(foo {42}));
console::write_line("foo {{42}}.equals(foo {{84}}) = {}", foo {42}.equals(foo {84}));
console::write_line();
console::write_line("!foo {{42}}.equals(foo {{42}}) = {}", !foo {42}.equals(foo {42}));
console::write_line("!foo {{42}}.equals(foo {{84}}) = {}", !foo {42}.equals(foo {84}));
console::write_line();
console::write_line("foo {{42}} == foo {{42}} = {}", foo {42} == foo {42});
console::write_line("foo {{42}} == foo {{84}} = {}", foo {42} == foo {84});
console::write_line();
console::write_line("foo {{42}} != foo {{42}} = {}", foo {42} != foo {42});
console::write_line("foo {{42}} != foo {{84}} = {}", foo {42} != foo {84});
}
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10