Create a base class called Radix10 which has a member function decimal. It can be set and display
by member functions. It also contains a virtual function called convert. Derive two classed from
Radix10. One is called Radix2 and the next is called Radix16. They redefine the convert function
such that the decimal value is displayed into binary or hexa_decimal. They have a data member
length which can be set by member functions. To convert the decimal data is divided by appropriate
radix length times and the remainder which is always from 0 to (radix-1) should be displayed in
reverse order. In hexa decimal, for remainder 10, 11, 12 ,13, 14 and 15 the codes A, B, C, D, E or F
should be used respectively.
Comments
Leave a comment