#include <xtd/xtd>
public:
explicit user(
int id,
const string& name) : id_ {
id}, name_ {name} {}
int id() const noexcept {return id_;}
const string& name() const noexcept {return name_;}
string to_string()
const noexcept override {
return string::format(
"user: id = {}, name = {}", id_, name_);}
private:
int id_ = 0;
string name_;
};
auto main() -> int {
auto user1 =
user {1,
"Example"};
auto user2 =
user {1,
"Example"};
auto user3 =
user {2,
"Different"};
}
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
static xtd::size combine(args_t... values) noexcept
Combines values into a hash code.
Definition hash_code.hpp:70
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
bool is(std::any value)
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:365
type_t as(any_object &o)
Casts a type into another type.
Definition __as_any_object.hpp:59
@ user
The environment variable is stored or retrieved from the HKEY_CURRENT_USER\Environment key in the Win...
Definition environment_variable_target.hpp:19
@ other
The operating system is other.
Definition platform_id.hpp:58
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
string to_string() const noexcept override
Returns the string representation of this xtd::read_only_span <type_t> object.
Definition read_only_span.hpp:375
bool equals(const object &obj) const noexcept override
Determines whether the specified object is equal to the current object.
Definition read_only_span.hpp:272
xtd::size get_hash_code() const noexcept override
Serves as a hash function for a particular type.
Definition read_only_span.hpp:296