Question: Create a class in C + + called CVector with an STL vector structure defined as a private data member. This class should have the

Create a class in C++ called CVector with an STL vector structure defined as a private data member. This class should have the following:
A. A default constructor.
B. A setVector method that can set the class data member by passing a vector as a parameter.
C. An add method can be used to add the vector within the CVector object to another object of the same class (remember, the method adds vectors of the same size). The adding should add the corresponding values of the two vectors to each other.
D. A + operator function can have the same effect as the add method.
E. A show method that prints out the content on the Vector data member.
F. Your main function should read and reflect the code below in Figure 3:
 Create a class in C++ called CVector with an STL vector

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!