...
Embed:
(wiki syntax)
Show/hide line numbers
Shape.cpp
00001 #include "mbed.h" 00002 #include "Shape.h" 00003 00004 Shape::Shape(int x){ 00005 _x = x; 00006 _y = -1; 00007 } 00008 00009 Shape::Shape(int x, int y){ 00010 _x = x; 00011 _y = y; 00012 } 00013 int Shape::getArea(){ 00014 if(_y == -1) 00015 return (_x * _x); 00016 else 00017 return (_x * _y); 00018 } 00019 00020 int Shape::getPerimeter(){ 00021 if(_y == -1) 00022 return (_x * 4 ); 00023 else 00024 return (2 * (_x + _y)); 00025 }
Generated on Wed Jul 13 2022 07:28:13 by 1.7.2