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