consolidate all repos to one for archive
This commit is contained in:
21
semester_2/programiranje_2/primeri/Example14/Rectangle.h
Normal file
21
semester_2/programiranje_2/primeri/Example14/Rectangle.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef EXAMPLE14_RECTANGLE_H
|
||||
#define EXAMPLE14_RECTANGLE_H
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class Rectangle : public Shape {
|
||||
private:
|
||||
int w, h;
|
||||
public:
|
||||
Rectangle() : Shape(), w(0), h(0) {
|
||||
}
|
||||
Rectangle(int x, int y, int w, int h) : Shape(x, y), w(w), h(h) {
|
||||
}
|
||||
double area() const {
|
||||
return w*h;
|
||||
}
|
||||
void print() const {
|
||||
std::cout << "Rectangle(" << x << ", " << y << ", " <<
|
||||
w << ", " << h << ")" << std::endl;}
|
||||
};
|
||||
#endif //EXAMPLE14_RECTANGLE_H
|
||||
Reference in New Issue
Block a user