Question: Code in C++ Create a class Url in a header file. This class should have a constructor that takes a url value as a string,

Code in C++

Create a class Url in a header file. This class should have a constructor that takes a url value as a string, as well as three getter functions: getScheme() which returns the scheme of the url, getDomain() which returns the domain of the url, and getPath() which returns the path of the url. Implement these functions in a separate source file.

The following starter code should run and print out the expected result once you have implemeneted your class.

Starter Code:

#include "url.h" int main() { Url url{ "https://example.com/path/to/file.txt" }; std::cout << "scheme = " << url.getScheme() << " "; std::cout << "domain = " << url.getDomain() << " "; std::cout << "path = " << url.getPath() << " "; } 

Sample Output:

scheme = https: domain = //example.com path = /path/to/file.txt

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!