diff options
Diffstat (limited to 'oop1w2')
-rw-r--r-- | oop1w2/Driehoek.cpp | 15 | ||||
-rw-r--r-- | oop1w2/Driehoek.h | 13 | ||||
-rw-r--r-- | oop1w2/Rechthoek.cpp | 14 | ||||
-rw-r--r-- | oop1w2/Rechthoek.h | 13 | ||||
-rw-r--r-- | oop1w2/Vorm.cpp | 13 | ||||
-rw-r--r-- | oop1w2/Vorm.h | 9 | ||||
-rw-r--r-- | oop1w2/main.cpp | 21 | ||||
l--------- | oop1w2/makefile | 1 |
8 files changed, 99 insertions, 0 deletions
diff --git a/oop1w2/Driehoek.cpp b/oop1w2/Driehoek.cpp new file mode 100644 index 0000000..1c1323c --- /dev/null +++ b/oop1w2/Driehoek.cpp @@ -0,0 +1,15 @@ +#include "Driehoek.h" + +Driehoek::Driehoek(double b, double h) { + breedte = b; + hoogte = h; +} + +double Driehoek::getSomGraden() { + return 180; +} + +double Driehoek::getOppervlakte() { + return breedte * hoogte * 0.5f; +} + diff --git a/oop1w2/Driehoek.h b/oop1w2/Driehoek.h new file mode 100644 index 0000000..f8a3a37 --- /dev/null +++ b/oop1w2/Driehoek.h @@ -0,0 +1,13 @@ +#pragma once + +#include "Vorm.h" + +class Driehoek : public Vorm { + public: + Driehoek(double breedte, double hoogte); + virtual double getOppervlakte(); + virtual double getSomGraden(); + private: + double breedte; + double hoogte; +}; diff --git a/oop1w2/Rechthoek.cpp b/oop1w2/Rechthoek.cpp new file mode 100644 index 0000000..1f7b313 --- /dev/null +++ b/oop1w2/Rechthoek.cpp @@ -0,0 +1,14 @@ +#include "Rechthoek.h" + +Rechthoek::Rechthoek(double b, double h) { + breedte = b; + hoogte = h; +} + +double Rechthoek::getSomGraden() { + return 360; +} + +double Rechthoek::getOppervlakte() { + return breedte * hoogte; +} diff --git a/oop1w2/Rechthoek.h b/oop1w2/Rechthoek.h new file mode 100644 index 0000000..4f526f9 --- /dev/null +++ b/oop1w2/Rechthoek.h @@ -0,0 +1,13 @@ +#pragma once + +#include "Vorm.h" + +class Rechthoek : public Vorm { + public: + Rechthoek(double breedte, double hoogte); + virtual double getSomGraden(); + virtual double getOppervlakte(); + private: + double breedte; + double hoogte; +}; diff --git a/oop1w2/Vorm.cpp b/oop1w2/Vorm.cpp new file mode 100644 index 0000000..c919d08 --- /dev/null +++ b/oop1w2/Vorm.cpp @@ -0,0 +1,13 @@ +#include "Vorm.h" + +Vorm::Vorm() { + return; +} + +double Vorm::getOppervlakte() { + return 0; +} + +double Vorm::getSomGraden() { + return 0; +} diff --git a/oop1w2/Vorm.h b/oop1w2/Vorm.h new file mode 100644 index 0000000..17cf486 --- /dev/null +++ b/oop1w2/Vorm.h @@ -0,0 +1,9 @@ +#pragma once + +class Vorm { + public: + Vorm(); + virtual double getOppervlakte(); + virtual double getSomGraden(); +}; + diff --git a/oop1w2/main.cpp b/oop1w2/main.cpp new file mode 100644 index 0000000..69db85b --- /dev/null +++ b/oop1w2/main.cpp @@ -0,0 +1,21 @@ +/*
+ * Do not adapt this file!!!
+ */
+#include "Driehoek.h"
+#include "Rechthoek.h"
+
+#include <iostream>
+
+int main()
+{
+ Vorm *driehoek = new Driehoek( 6.0, 8.0 );
+ Vorm *rechthoek = new Rechthoek( 6.0, 8.0 );
+
+ std::cout << driehoek ->getOppervlakte() << " " << driehoek ->getSomGraden() << std::endl;
+ std::cout << rechthoek->getOppervlakte() << " " << rechthoek->getSomGraden() << std::endl;
+
+ delete driehoek;
+ delete rechthoek;
+
+ return 0;
+}
diff --git a/oop1w2/makefile b/oop1w2/makefile new file mode 120000 index 0000000..a4e84c6 --- /dev/null +++ b/oop1w2/makefile @@ -0,0 +1 @@ +../week.mk
\ No newline at end of file |