xtd 0.2.0
xtd::object Class Reference

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.

class core_export_ object
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.
Examples:
boxing.cpp, delegate.cpp, event.cpp, format_class_object.cpp, lock.cpp, and send_message_to_form.cpp.

Constructors

 object ()=default
 Create a new instance of the ultimate base class object. More...
 

Methods

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...
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance. More...
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const noexcept
 Creates a shallow copy of the current object. More...
 
virtual xtd::ustring to_string () const noexcept
 Returns a sxd::ustring that represents the current object. More...
 
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]

bool xtd::object::equals ( const object obj) const
noexcept

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.

◆ 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.

◆ get_type()

virtual type_object xtd::object::get_type ( ) const
virtualnoexcept

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.
Examples:
monitor.cpp.

◆ memberwise_clone()

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

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

Returns a sxd::ustring that represents the current object.

Returns
A string that represents the current object.
Examples
The following code example demonstrates what to_string returns.

Reimplemented in xtd::drawing::graphics, xtd::ustring, xtd::drawing::color, xtd::forms::control, xtd::date_time, xtd::uri, xtd::io::file_system_info, xtd::time_span, xtd::forms::month_calendar, xtd::drawing::drawing_2d::graphics_path, xtd::environment::xtd_library, xtd::diagnostics::stack_trace, xtd::drawing::point, xtd::forms::menu_item, xtd::drawing::font, xtd::drawing::rectangle, xtd::net::ip_address, xtd::drawing::rectangle_f, xtd::forms::tool_bar_button, xtd::forms::file_dialog, xtd::forms::status_bar_panel, xtd::version, xtd::drawing::drawing_2d::matrix, xtd::drawing::pen, xtd::drawing::imaging::image_format, xtd::diagnostics::stack_frame, xtd::operating_system, xtd::drawing::icon, xtd::forms::progress_bar, xtd::forms::create_params, xtd::guid, xtd::forms::style_sheets::background_image, xtd::io::drive_info, xtd::drawing::point_f, xtd::forms::horizontal_control_layout_style, xtd::forms::vertical_control_layout_style, xtd::system_exception, xtd::forms::cursor, xtd::forms::track_bar, xtd::forms::numeric_up_down, xtd::forms::emoticon, xtd::forms::menu, xtd::forms::padding, xtd::forms::style_sheets::length, xtd::enum_object< enum_t >, xtd::threading::thread_local_object< value_t >, xtd::drawing::font_family, xtd::forms::radio_button, xtd::forms::style_sheets::lengths, xtd::drawing::size, xtd::forms::style_sheets::theme, xtd::box< type_t >, xtd::forms::message, xtd::drawing::size_f, xtd::forms::up_down_button, xtd::forms::country, xtd::forms::control_layout_style, xtd::distribution, xtd::forms::list_control::item, xtd::cpp_language, xtd::forms::renderer, xtd::net::ip_end_point, xtd::net::socket_address, xtd::compiler, xtd::forms::selection_range, xtd::forms::domain_up_down::item, xtd::forms::link_area, xtd::target_type, xtd::processor, xtd::net::dns_end_point, xtd::type_object, xtd::toolkit, xtd::web::css::property, xtd::drawing::brush, xtd::net::end_point, and xtd::io::string_writer.

Examples:
boxing.cpp.

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