Shows how to use xtd::interface class.
#include <xtd/as>
#include <xtd/interface>
#include <xtd/console>
namespace interface2_example {
public:
virtual string to_string() const = 0;
};
public:
program() = default;
string to_string() const override {return "program";}
};
}
auto main() -> int {
auto stringable = as<interface2_example::istringable>(new_ptr<interface2_example::program>());
console::write_line(stringable->to_string());
}
Represent an interface class.
Definition interface.h:31
Provides a way to represent the current object as a string.
Definition istringable.h:23
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10