Assume the existence of a class GraphicProgram with a string member,executableNa
ID: 3544941 • Letter: A
Question
Assume the existence of a class GraphicProgram with a string member,executableName, and data member, windowPtr, of type Window * (where Window is also a class type ).
Assume further that the Window class has a function called clone, that takes no parameters and returns a pointer to a new copy of the Window.
Write a copy constructor for the GraphicProgram class that uses the clone function to make a proper copy of the Window member (rather than simple member assignment ).
The executable member may be copied using simple member assignment .
thanks a million
Explanation / Answer
GraphicProgram(const GraphicPrograme & obj)
{
executableName = obj.executableName;
windowPtr = obj.windowPtr->clone();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.