xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Public Member Functions | Static Public Member Functions | List of all members
xtd::object Class Reference

#include <object.h>

Definition

Supports all classes in the xtd class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all classes in the xtd. It is the root of the type hierarchy.

Namespace
xtd
Library
xtd.core
Examples
The following example defines a point type derived from the object class and victuals many of the virtual methods of the object class. In addition, the example shows how to call many of the static and instance methods of the object class.

Inherited by xtd::background_color, xtd::beep, xtd::compiler, xtd::console_key_info, xtd::cpp_language, xtd::debugstreambuf, xtd::delegate< result_t()>, xtd::delegate< result_t(arguments_t...)>, xtd::diagnostics::process, xtd::diagnostics::process_start_info, xtd::diagnostics::stack_frame, xtd::diagnostics::stack_trace, xtd::diagnostics::stopwatch, xtd::diagnostics::switch_base, xtd::diagnostics::trace_event_cache, xtd::diagnostics::trace_filter, xtd::diagnostics::trace_listener, xtd::diagnostics::trace_source, xtd::drawing::brush, xtd::drawing::color, xtd::drawing::font, xtd::drawing::font_family, xtd::drawing::graphics, xtd::drawing::icon, xtd::drawing::image, xtd::drawing::imaging::color_palette, xtd::drawing::imaging::frame_dimension, xtd::drawing::imaging::image_format, xtd::drawing::imaging::property_item, xtd::drawing::pen, xtd::drawing::point, xtd::drawing::point_f, xtd::drawing::rectangle, xtd::drawing::rectangle_f, xtd::drawing::size, xtd::drawing::size_f, xtd::drawing::string_format, xtd::drawing::text::font_collection, xtd::event_args, xtd::foreground_color, xtd::forms::application_context, xtd::forms::application_informations, xtd::forms::component, xtd::forms::control_layout_style, xtd::forms::control_ref_less, xtd::forms::country, xtd::forms::cursor, xtd::forms::emoticon, xtd::forms::enable_debug, xtd::forms::flat_button_appearance, xtd::forms::layout::sorter_none, xtd::forms::link, xtd::forms::message, xtd::forms::padding, xtd::forms::renderer, xtd::forms::screen, xtd::forms::settings, xtd::forms::theme_base, xtd::forms::use_wait_cursor, xtd::guid, xtd::io::text_reader, xtd::io::text_writer, xtd::media::system_sound, xtd::net::end_point, xtd::net::ip_address, xtd::net::ip_host_entry, xtd::net::network_credential, xtd::net::socket_address, xtd::net::sockets::ip_packet_information, xtd::net::sockets::ip_v6_multicast_option, xtd::net::sockets::linger_option, xtd::net::sockets::multicast_option, xtd::net::sockets::send_packets_element, xtd::net::sockets::socket, xtd::net::sockets::socket_information, xtd::net::sockets::tcp_client, xtd::net::sockets::tcp_listener, xtd::net::sockets::udp_client, xtd::operating_system, xtd::processor, xtd::random, xtd::reset_color, xtd::security::secure_string, xtd::system_exception, xtd::tracestreambuf, xtd::ustring, xtd::version, xtd::web::css::css_reader, xtd::web::css::css_writer, xtd::web::css::property, and xtd::web::css::selector.

Public Member Functions

 object ()=default
 Create a new instance of the ultimate base class object. More...
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object. More...
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type. More...
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const
 Gets the type of the current instance. More...
 
virtual xtd::ustring to_string () const noexcept
 Returns a std::string that represents the current object. More...
 

Static Public Member Functions

static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal. More...
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance. More...
 

Constructor & Destructor Documentation

◆ object()

xtd::object::object ( )
default

Create a new instance of the ultimate base class object.

Remarks
This constructor is called by constructors in derived classes, but it can also be used to directly create an instance of the object class.

Member Function Documentation

◆ equals() [1/2]

virtual bool xtd::object::equals ( const object obj) const
virtualnoexcept

Determines whether the specified object is equal to the current object.

Parameters
objThe object to compare with the current object.
Returns
true if the specified object is equal to the current object. otherwise, false.
Examples
The following code example compares the current instance with another object.

Reimplemented in xtd::net::ip_address, and xtd::guid.

◆ equals() [2/2]

static bool xtd::object::equals ( const object object_a,
const object object_b 
)
staticnoexcept

Determines whether the specified object instances are considered equal.

Parameters
object_aThe first object to compare.
object_bThe second object to compare.
Returns
true if object_a is the same instance as object_b or if both are null references or if object_a(object_b) returns true. otherwise, false.
Examples
The following code example compares different objects.

◆ get_hash_code()

virtual size_t xtd::object::get_hash_code ( ) const
virtualnoexcept

Serves as a hash function for a particular type.

Returns
size_t A hash code for the current object.

Reimplemented in xtd::ustring.

◆ memberwise_clone()

template<typename object_t >
std::unique_ptr<object_t> xtd::object::memberwise_clone ( ) const
inline

Gets the type of the current instance.

Returns
The type instance that represents the exact runtime type of the current instance.
Examples
The following code example demonstrates that GetType returns the runtime type of the current instance.

Creates a shallow copy of the current object.

Returns
A shallow copy of the current object.
Examples
The following code example shows how to copy an instance of a class using memberwise_clone.

◆ reference_equals()

static bool xtd::object::reference_equals ( const object object_a,
const object object_b 
)
staticnoexcept

Determines whether the specified object instances are the same instance.

Parameters
object_aThe first object to compare.
object_bThe second object to compare.
Returns
true if object_a is the same instance as object_b or if both are null references; otherwise, false.
Examples
The following code example uses reference_equals to determine if two objects are the same instance.

◆ to_string()

virtual xtd::ustring xtd::object::to_string ( ) const
virtualnoexcept

The documentation for this class was generated from the following file: