Starting from:

$30

CSE165-Lab 4 Solved

1.                   Write a function that takes a pointer argument, modifies what the pointer points to, and then returns the destination of the pointer as a reference.

 

2.                    Create a function that takes an argument of a reference to a pointer to a pointer and modifies that argument. In main( ), call the function.

 

This exercise creates the design pattern called proxy. Start with a base class Subject and give it three functions: f(), g(), and h(). Now inherit a class Proxy and two classes Implementation1 and Implementation2 from Subject. Proxy should contain a pointer to a Subject, and all the member functions for Proxy should just turn around and make the same calls through the Subject pointer. The Proxy constructor takes a pointer to a Subject that is installed in the Proxy (usually by the constructor). In main(), create two different Proxy objects that use the two different implementations. Now modify Proxy so that you can dynamically change implementations

More products