Question: Please answer in C++ Coding language!!! The Problem: Thing.h main.cc WHAT I HAVE TO IMPLEMENT in Thing.cc In class you saw how to create a
Please answer in C++ Coding language!!!
The Problem:

Thing.h

main.cc

WHAT I HAVE TO IMPLEMENT in Thing.cc

In class you saw how to create a dynamic list of property names. This time we are going to extend that by making a class that keeps track of both properties and values (e.g., property: color, value: green). Write a class Thing. It should have these private variables: - int props_ct_to count how many properties we have, - int props_max_ to return the maximum number or properties, - string *properties_containing the names of the properties, - string *values_containing the values of the properties. Your class should have the following methods: - Thing(int size) - a constructor that takes the max size of the properties and values arrays. - Thing(const Thing \&) - a copy constructor. - The other two methods you need because of the Rule of Three. Make your own private copy_ and destroy_ methods to assist with this. - int set_property(string name, string value) - Takes a property name and value, and inserts them into the arrays. Returns the index into the array if successul, and 1 if the array was full. If the property name already exists, replace the value. - string get_property(string name) - Returns the corresponding value for a given property name, or else an empty string if that property is not found. - You may want to have a copy (const Thing \&) method, but that is optional. Testing Your Code Run the following commands to compile and execute your code: make ./ main Sample Output Kermit is Green Kermit is Green Grover is Blue \#pragma once \#include string namespace potd \{ class Thing \{ public: Thing(int); Thing(const Thing \&); Thing \& operator=(const Thing \&); Thing () ; int set_property(std: :string,std::string); std::string get_property(std::string); private: void_copy(const Thing \&); void_destroy(); std: :string *properties; std: :string *values_; int props_ct_; int props_max_; \}; \} \( \begin{array}{ll}1 & \text { // Your code here! } \\ 2 & \text { \#include "Thing.h" } \\ 3 & \\ 4 & \text { using namespace potd; } \\ 5 & \\ 6 & \text { Thing:: Thing(int size) }\{ \\ 7 & \\ 8 & \} \\ 9 & \text { Thing: :Thing(const Thing \&) }\{ \\ 10 & \\ 11 & \} \\ 12 & \text { Thing: : Thing \& operator=(const Thing \&)\{ } \\ 13 & \\ 14 & \} \\ 15 & \\ 16 & \text { Thing: : Thing()\{\} } \\ 17 & \\ 18 & \text { int Thing::set_property(std::string name, std::string value) }\{ \\ 19 & \\ 20 & \} \\ 21 & \text { std::string Thing::get_property(std: :string name) }\{ \\ 22 & \text { \} } \\ 23 & \text { \} }\end{array} \)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
