Browser History
hardQuestion 524Build a class BrowserHistory that models the back and forward buttons of a web browser using two stacks. The browser starts on the page home.
Implement these public methods:
1. void visit(const string& url) — pushes the current page onto the back stack, makes url the current page, and clears the forward stack
2. string back() — if the back stack is empty, return No history and change nothing; otherwise push the current page onto the forward stack, pop the back stack into the current page, and return it
3. string forward() — if the forward stack is empty, return No forward and change nothing; otherwise push the current page onto the back stack, pop the forward stack into the current page, and return it
4. string current() const — returns the current page
Example: starting on home, after visit("a.com") and visit("b.com") the test prints back(), forward() and forward() again, one per line (see Expected Output).
Do NOT write a main function.
Expected output
a.com b.com No forward home No history x.com No forward x.com home No history home
= newline. The output ends with a newline, so print one after the last line.
Your output
Run your code to see the output here...