Question: How do I get this to compile in C++ #include window.h // Use standard main to have console background: int main() { Window window( Demo

How do I get this to compile in C++

#include "window.h" // Use standard main to have console background: int main() { Window window( "Demo" ); window.show(); window.run(); char ch; std::cout << "Enter x and press Enter to exit: "; std::cin >> ch; }

// window.cpp #include "window.h" //----------------------------- // Window implementation //----------------------------- Window::Window( char* title_ ) : inp_box ( new Input), out_box ( new Output), btn_set_text ( new Button) { title = title_; //inp_box = new Input; //out_box = new Output; //btn_set_text = new button; inp_box.value( "12345" ); out_box.value( "67890" ); } void Window::click_btn_set_text() { char* text = inp_box.value(); out_box.value( text ); } void Window::show() { std::cout << "Window: " << title << ' '; std::cout << inp_box.value() << ' '; std::cout << out_box.value() << ' '; std::cout << ' '; } void Window::run() { click_btn_set_text(); // user clicks the button show(); // display changes } //----------------------------- // Input implementation //----------------------------- char* Input::value() { return text; } void Input::value( char* text_ ) { text = text_; } //----------------------------- // Input implementation //----------------------------- char* Output::value() { return text; } void Output::value( char* text_ ) { text = text_; }

// window.h // ... #include #include // for unique_ptr // ... class Window { char* title; std::unique_ptr< Input > inp_box; std::unique_ptr< Output > out_box; std::unique_ptr< Button > btn_set_text; public: // constructor Window(char* title_); // operations void click_btn_set_text(); void show(); void run(); }; // class Window

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!