1
0
Fork 0

add input for ex8.3

This commit is contained in:
Frank Filthaut 2019-12-10 09:15:28 +01:00 committed by Eric Teunis de Boone
parent 17845570ef
commit fae6435f3c
2 changed files with 39 additions and 0 deletions

16
ex8.3/Shape.hh Normal file
View file

@ -0,0 +1,16 @@
#ifndef SHAPE_HH
#define SHAPE_HH
class Shape {
public:
// Constructor, destructor
Shape() {} ;
virtual ~Shape() {} ;
// Pure virtual interface functions
virtual double surface() const = 0 ;
virtual double circumference() const = 0 ;
} ;
#endif

23
ex8.3/Square.hh Normal file
View file

@ -0,0 +1,23 @@
#ifndef SQUARE_HH
#define SQUARE_HH
#include "Shape.hh"
class Square: public Shape {
public:
// Constructor, destructor
Square(double size) : _size(size) {} ;
virtual ~Square() {} ;
// Implementation of abstract interface
virtual double surface() const { return _size * _size ; }
virtual double circumference() const { return 4 * _size ; }
private:
double _size ;
} ;
#endif