Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions