I calculate the fourth to make'm designing a program that takes three points and parallel chart I By what I'm doing:
struct Smantrlogram public polygon {Smantrbhuj (Point TL, Point Trash, Point blocks) Point bar; Int number = tr.y-tl.y; Int denom = tr.x-tl.x; Br.x = denom + bl.x; Br.y = number + bl.y; }}; Paralegal :: Paralegal (Point TL, Point Tr, Point Blow) {Joint (TL); (Tr); (BL); (Br); }; While compiling I get the following error:
hw6pr2.cpp: 15: 1: error: Parallagrag re-definition :: Paralelogram (Point, Point, Point) Ã ¢ hw6pr2.cpp: 6: 2: error: a Smantrlelagra :: Paralelogram (Point, Point, Point) is defined before My question is: If The way I am right from the polygon class? If so, why am I getting this error?
You Parallelogram :: There are two definitions of Parallelogram (Point, Point, Point) < / Code>; One out of the class and one out You can not have several definitions of the function. Let's assume that addition adds a dot to your polygon , it seems that you really want just to be a part of the definition first you can define it in your class: struct Smantrlogram public polygon {Smantrbhuj (Point TL, Point Trash, Point blocks) {Point bar; Int number = tr.y-tl.y; Int denom = tr.x-tl.x; Br.x = denom + bl.x; Br.y = number + bl.y; (TL); (Tr); (BL); (Br); }}; Alternatively, you can declare it inside your class and then define it: struct parallelogram: public polygon {parallelogram (point tl, point tr, point bl) ; }; Parallelogram :: Parallel Clause (Point TL, Point Tr, Point Blow) {Point Br. Int number = tr.y-tl.y; Int denom = tr.x-tl.x; Br.x = denom + bl.x; Br.y = number + bl.y; (TL); (Tr); (BL); (Br); }
No comments:
Post a Comment