https://github.com/l-paz91/principles-practice/tree/master/Graphics%20Files
Chapter 13 // Exercise 10
Define a class Regular_Polygon. Use the center, the number of sides (>2), and the distance from the center to a corner as constructor arguments.
Github: https://github.com/l-paz91/principles-practice/tree/master/Chapter%2013/Exercise%2010
I assume "distance from center to a corner" means the radius of the outer circle of a Polygon. I wish we had done this one as Exercise 9 as then I could've just made Regular_hexagon a child of Regular Polygon.
I decided to do that and it got me thinking about a universal "tile" function for any type of polygon, however I want the tile function to remain static so that you can call it without actually having to have an instance of the object and you can't have virtual static functions in c++.
I decided to do that and it got me thinking about a universal "tile" function for any type of polygon, however I want the tile function to remain static so that you can call it without actually having to have an instance of the object and you can't have virtual static functions in c++.
No comments:
Post a Comment