Modernes C++ programmieren

Okt 20, 2024

lst-0005-book.cpp

namespace plant {
    // … as before …
    std::ostream& operator<<(std::ostream&, const Tree&) {};
    namespace debug {
        std::ostream& operator<<(std::ostream&, const Tree&) {};
    }
}
plant::Tree tree{"MyTree"};
void run() {
    using namespace plant;
    cout << tree << "\n";
}
void diagnostic() {
    using namespace plant::debug;
    cout << tree << "\n";
}
int main() {
    run();
    diagnostic();
}