Lab 4
Loading...
Searching...
No Matches
rectangle.h
Go to the documentation of this file.
1#pragma once
2#include "shape.h"
3
4//class rectangle, derived from base class shape
5class Rectangle : public Shape {
6private:
7 int length;
8 int width;
9
10public:
11 //class constructor, requires length and width
12 Rectangle(int l, int w) {
13 length = l;
14 width = w;
15 }
16 //area of rectangle = length x width
18 return length * width;
19 }
20 //overriden draw function
21 void draw() override {
22 drawItem("rectangle.txt");
23 }
24};
Definition rectangle.h:5
int calculateArea()
Definition rectangle.h:17
void draw() override
Definition rectangle.h:21
Rectangle(int l, int w)
Definition rectangle.h:12
Definition shape.h:7
void drawItem(const std::string &fileName)
Definition draw.cpp:4