xtd 0.2.0
Loading...
Searching...
No Matches
action1.cpp

This example simplifies this code by instantiating the xtd::action delegate instead of explicitly defining a new delegate and assigning a named method to it.

#include <xtd/console>
#include <xtd/delegate>
#include <xtd/environment>
#include <xtd/forms/message_box>
using namespace xtd;
using namespace xtd::forms;
using display_message = delegate<void(const string&)>;
void show_windows_message(const string& message) {
message_box::show(message);
}
void write_line(const string& message) {
console::write_line(message);
}
auto main() -> int {
auto message_target = display_message {};
if (environment::get_command_line_args().size() > 1)
message_target = show_windows_message;
else
message_target = write_line;
message_target("Hello, World!");
}
Implements a Windows message.
Definition message.hpp:28
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10