The purpose of this lab is to review Object concepts and implement operator overloading
Create a new object called twoChar that is a completely formed object
(i.e., abstract data type).
-
twoChar is to contain two data members:
- leftChar
- rightChar
- Write set and get methods for both left and right characters
- Write a print method to print twoChar
- Test it
- Create constructors:
- Set both characters
- Default to blanks
- Test it
- Create a read leftChar, read rightChar, and read twoChar methods that ask the user for the appropriate character(s)
- Did you think to have read twoChar call the other reads?
- Did you get rid of extraneous input (i.e, use getline and only take the
first character input
- Test it
- Overload the + operator to concantenate leftChar and rightChar and
return a string
- Test it
A solution is available
Now, change the Rational code so that method multiply is called "*"
Modify the main and test it