Question: Write in C++ Create a new URL class which inherits from the DynamicString class. A URL is a Dynamic String with a specific format ://

Write in C++

Write in C++ Create a new URL class which inherits from the

Create a new URL class which inherits from the DynamicString class. A URL is a Dynamic String with a specific format :///. When comparing two urls, the scheme and authority are case-insensitive but the path is case-sensitive. At a minimum you will need to override the following methods: URL(const char* str) - Constructor checks that the str is a correctly formatted url. For this assignment, any url that has "://" with at least one character on each side of the "://" is considered valid. If the url is incorrectly formatted you should throw an error. Note that they Dynamic String(const char* str) constructor should be used to actually store the string. int compare(const URL& other) - Compares to URLs. The scheme (i.e. the portion of the string prior to "://") and the authority (i.e. the portion of the string between "://" and the next "/") should be compared ignoring upper/lower- case differences. The path should be compared taking differences in upper/lower case into account. Hints for the URL class You may want to store the Scheme, Authority and Path as distinct class variables for easier comparisons between strings. Use the existing DynamicString methods like find, compare and iCompare to parse and compare urls

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!