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 Class Reference
A library to create square and rectangle objects. More...
#include <Shape.h>
Public Member Functions | |
| Shape (int x) | |
| create an object for square | |
| Shape (int x, int y) | |
| create an object for rectangle | |
| int | getArea () |
| returns to area of rectangle/square | |
| int | getPerimeter () |
| returns to perimeter of rectangle/square | |
Detailed Description
A library to create square and rectangle objects.
calculates the area and perimeter
Example:
#include "mbed.h" #include "Shape.h" Shape rect(3,4); Shape squr(1); int main() { printf(" area of rect = %d \n", rect.getArea()); printf("perimeter of square = %d \n", squr.getPerimeter()); }
Definition at line 27 of file Shape.h.
Constructor & Destructor Documentation
| Shape | ( | int | x ) |
| Shape | ( | int | x, |
| int | y | ||
| ) |
Member Function Documentation
| int getArea | ( | ) |
Generated on Wed Jul 13 2022 07:28:13 by
1.7.2