|
@@ -637,7 +637,7 @@ In this exercise you will practice the creation of an overloaded function.
|
637
|
637
|
// add the point (x,y) to the graph of the circle
|
638
|
638
|
wCircleR5.AddPointToGraph(x,y);
|
639
|
639
|
|
640
|
|
- The line `XYPlotWindow wCircleR5;` creates a `wCircleR5` object that will be the window where the graph will be drawn, in this case the graph of a circle of radius 5. In a similar way, the objects `wCircle` and `wButterfly` are created. Observe the `for` cycle. In this cycle a series of values for the angle $t$ is generated and the function `circle` is invoked, passing the value for $t$ and the references to $x$ and $y$. The `circle` function does not return a value, but using parameters by reference, it calculates the values for the coordinates $xCoord$ and $yCoord$ for the circle with center in the origin and radius 5, and allows the `main` function to have these values in the `x` , `y` variables.
|
|
640
|
+ The line `XYPlotWindow wCircleR5;` creates a `wCircleR5` object that will be the window where the graph will be drawn, in this case the graph of a circle of radius 5. In a similar way, the objects `wCircle` and `wButterfly` are created. Observe the `for` cycle. In this cycle a series of values for the angle $t$ is generated and the function `circle` is invoked, passing the value for $t$ and the references to $x$ and $y$. The `circle` function does not return a value, but using parameters by reference, it calculates the values for the coordinates $xCoord$ and $yCoord$ for the circle with center in the origin and radius 5, and allows the `main` function to have these values in the `x` , `y` variables.
|
641
|
641
|
|
642
|
642
|
After the function call, each ordered pair $(x,y)$ is added to the circle’s graph by the member function `AddPointToGraph(x,y)`. After the cycle, the member function `Plot()` is invoked, which draws the points, and the member function `show()`, which displays the graph. The *members functions* are functions that allow use to work with and object’s data. Notice that each one of the member functions is written after `wCircleR5`, followed by a period. In an upcoming laboratory experience you will learn more about objects, and practice how to create them and invoke their method functions.
|
643
|
643
|
|
|
@@ -687,4 +687,4 @@ Use "Deliverables" in Moodle to hand in the file `main()` that contains the func
|
687
|
687
|
|
688
|
688
|
[2] http://paulbourke.net/geometry/butterfly/
|
689
|
689
|
|
690
|
|
-[3] http://en.wikipedia.org/wiki/Parametric_equation
|
|
690
|
+[3] http://en.wikipedia.org/wiki/Parametric_equation
|