xtd 0.2.0
Loading...
Searching...
No Matches

◆ to_string() [1/3]

xtd::string xtd::time_span::to_string ( ) const
overridevirtualnoexcept

Returns a xtd::string that represents the current object.

Returns
A string that represents the current object.
Examples
The following code example demonstrates what to_string returns.
#include <xtd/xtd>
using namespace xtd;
namespace examples {
namespace object_test {
class object1 : public object {
};
}
}
auto main() -> int {
ptr<object> obj1 = new_ptr<examples::object_test::object1>();
console::write_line(obj1->to_string());
ptr<object> obj2 = new_ptr<date_time>(1971, 1, 5, 23, 5, 0);
console::write_line(obj2->to_string());
ptr<object> obj3 = new_ptr<boolean_object>();
console::write_line(obj3->to_string());
}
// This code produces the following output :
//
// examples::object_test::object1
// Tue Jan 5 23:05:00 1971
// false
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
xtd::sptr< type_t > ptr
The xtd::ptr object is a shared pointer.
Definition ptr.h:27
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10

Reimplemented from xtd::object.

Examples
time_span.cpp, and time_span_from_hours.cpp.