A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.microsoft.com/en-us/cpp/cppcx/platform-object-class below:

Platform::Object Class | Microsoft Learn

Provides common behavior for ref classes and ref structs in Windows Runtime apps. All ref class and ref struct instances are implicitly convertible to Platform::Object^ and can override its virtual ToString method.

Syntax
public ref class Object : Object
Members Public Constructors Name Description Object::Object Initializes a new instance of the Object class. Public Methods Inheritance Hierarchy

Object

Object

Requirements

Header: vccorlib.h

Namespace: Platform

Object::Equals Method

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

Syntax
bool Equals(
    Object^ obj
)
Parameters

obj
The object to compare.

Return Value

true if the objects are equal, otherwise false.

Object::GetHashCode Method

Returns the IUnknown* identity value for this instance if it is a COM object, or a computed hash value if it is not a COM object.

Syntax
public:int GetHashCode();
Return Value

A numeric value that uniquely identifies this object.

You can use GetHashCode to create keys for objects in maps. You can compare hash codes by using Object::Equals. If the code path is extremely critical and GetHashCode and Equals are not sufficiently fast, then you can drop down to the underlying COM layer and do native IUnknown pointer comparisons.

Object::GetType Method

Returns a Platform::Type object that describes the runtime type of an object.

Syntax
Object::GetType();
Property Value/Return Value

A Platform::Type object that describes the runtime type of the object.

The static Type::GetTypeCode can be used to get a Platform::TypeCode Enumeration value that represents the current type. This is mostly useful for built-in types. The type code for any ref class besides Platform::String is Object (1).

The Windows::UI::Xaml::Interop::TypeName class is used in the Windows APIs as a language-independent way of passing type information between Windows components and apps. The Platform::Type Class has operators for converting between Type and TypeName.

Use the typeid operator to return a Platform::Type object for a class name, for example when navigating between XAML pages:

rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);
Object::Object Constructor

Initializes a new instance of the Object class.

Syntax
public:Object();
Object::ReferenceEquals Method

Determines whether the specified Object instances are the same instance.

Syntax
public:static bool ReferenceEquals(  Object^ obj1,   Object^ obj2);
Parameters

obj1
The first object to compare.

obj2
The second object to compare.

Return Value

true if the two objects are the same; otherwise, false.

Object::ToString Method (C++/CX)

Returns a string that represents the current object.

Syntax
public:
virtual String^ ToString();
Return Value

A string that represents the current object. You can override this method to provide a custom string message in your ref class or struct:

public ref class Tree sealed
{
public:
    Tree(){}
    virtual Platform::String^ ToString() override
    {
      return "I'm a Tree";
    }
};
See also

Platform Namespace
Platform::Type Class
Type System


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4