![]() ![]() ![]() ![]() | A function that constructs, initializes and assigns LineSegments. | Lecture 3 - slide 16 : 36 Program 3 |
#include <iostream> #include "point-lineseg.h" using namespace std; void h(){ LineSegment ls1, // LineSegment(10) constructed ls2 = ls1, // copy initialization ls3; // LineSegment(10) constructed ls3 = ls2; // copy assignment // All LineSegments refer to different Point arrays. // Destructors called for ls1, ls2, ls3: // Now OK. } int main(){ h(); }