Question: Part - B ) . [ 1 5 % ] Further implement a class MyClassInt as the datatype of variables to store in an MyArray

Part-B).[15%] Further implement a class MyClassInt as the datatype of variables to store in an MyArray
object. The class MyClassint stores an int number and only contains one private value:
val: an int variable storing a number.
MyClassint further contains the following public member functions:
MyClassint () :the default constructor to initialize val=0.
MyClassint (int v) :the parameterized constructor to initialize val=v.
operator=:overload the operator= that copies the value of another object to the current object.
Use deep copy.
operator: overload the operator>T> : overload the operator >to compare the object with another object through the value
of their member variables val. Return true if the current object is larger; otherwise return false.
Create an object of MyArray by assigning the template Tas MyClassint with capacity of5. Then print the max
variables storing in the object as shown in the examples.
Note: You need to overload the operators of MyClassint correctly in order to call the function getMax ()
defined in MyArray.
Example-1(Inputis underlined):
Example-2(Inputis underlined):
Part - B ) . [ 1 5 % ] Further implement a class

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 Programming Questions!