#include <xtd/environment>
#include <xtd/format>
#include <xtd/println>
public:
character() = default;
character(const string& name, const string& rank) noexcept : name_(name), rank_(rank) {}
const string& name() const noexcept {return name_;}
const string& rank() const noexcept {return rank_;}
string to_string(
const string&
format,
const std::locale& loc)
const override {
if (fmt == "F") return name_ + " (" + rank_ + ")";
if (fmt == "N") return name_;
if (fmt == "R") return rank_;
}
private:
string name_;
string rank_;
};
auto main() -> int {
try {
auto char1 = character {"Jean-Luc Picard", "Captain"};
}
}
bool is_empty() const noexcept
Definition basic_string.hpp:1471
Defines the base class for predefined exceptions in the xtd namespace.
Definition exception.hpp:30
@ e
The E key.
Definition console_key.hpp:96
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
void println(FILE *file)
Writes the current line terminator to the file output stream using the specified format information.
Definition println.hpp:14
string to_string() const noexcept override
Returns the string representation of this xtd::read_only_span <type_t> object.
Definition read_only_span.hpp:375