Overloaded -> Operator in a SmartPointer Class
Understand the implementation of a Container and a SmartPointer class.
We'll cover the following
Problem
Write a program that implements a Container
class that maintains an array of Sample
objects. Create a SmartPointer
class that would act as a friend of the Container
class. Overload the -> operator
in the SmartPointer
class such that in main( )
we can use the SmartPointer
object like a pointer.
Sample run
Here’s what you should see when you run the program.
10 3.14
31.4
20 6.28
125.6
30 9.45
283.5
40 8.66
346.4
Coding solution
Here is a solution to the problem above.
Get hands-on with 1400+ tech skills courses.