Lab 4
Loading...
Searching...
No Matches
source
repos
PROG71020_Lab4
Lab4
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
5
class
Rectangle
:
public
Shape
{
6
private
:
7
int
length;
8
int
width;
9
10
public
:
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
17
int
calculateArea
() {
18
return
length * width;
19
}
20
//overriden draw function
21
void
draw
()
override
{
22
drawItem
(
"rectangle.txt"
);
23
}
24
};
Rectangle
Definition
rectangle.h:5
Rectangle::calculateArea
int calculateArea()
Definition
rectangle.h:17
Rectangle::draw
void draw() override
Definition
rectangle.h:21
Rectangle::Rectangle
Rectangle(int l, int w)
Definition
rectangle.h:12
Shape
Definition
shape.h:7
drawItem
void drawItem(const std::string &fileName)
Definition
draw.cpp:4
shape.h
Generated by
1.11.0