Assume the existence of a class GraphicProgram with a string member,executableNa
ID: 3661002 • 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.Explanation / Answer
GraphicProgram(const GraphicProgram &a){
executableName=a.executableName;
windowPtr=a.windowPtr->clone();
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.