Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Circle.cpp
- //
- // CompSci 141 / CSE 141 / Informatics 101 Fall 2009
- // Assignment #4
- //
- // I've included the definition of the Circle_new function, since you haven't
- // seen any examples of it. Other than that, you'll need to fill in the bodies
- // of the remaining functions.
- #include "Circle.h"
- void** vmtCircle;
- // You shouldn't need to modify this function at all. It creates a new
- // Circle "object," calls the Circle constructor on it, then initializes
- // the vmt field of the newly-created Circle. You may be wondering why
- // the vmt field is being initialized here and not in the Circle
- // constructor. The reason is because it should only be initialized
- // once, but multiple constructors may be called (e.g. Square's constructor
- // will call Rectangle's, which will call Shape's) during the initialization
- // of an object.
- Circle* Circle_new(double positionX, double positionY, double radius)
- {
- Circle* c = new Circle;
- Circle_Circle(c, positionX, positionY, radius);
- c->vmt = vmtCircle;
- return c;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement