Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Shape.cpp
- Committer:
- kaushalpkk
- Date:
- 2019-08-08
- Revision:
- 0:0bd684b9e2c3
File content as of revision 0:0bd684b9e2c3:
#include "mbed.h"
#include "Shape.h"
Shape::Shape(int x){
_x = x;
_y = -1;
}
Shape::Shape(int x, int y){
_x = x;
_y = y;
}
int Shape::getArea(){
if(_y == -1)
return (_x * _x);
else
return (_x * _y);
}
int Shape::getPerimeter(){
if(_y == -1)
return (_x * 4 );
else
return (2 * (_x + _y));
}