diff options
Diffstat (limited to 'oop1w1')
-rw-r--r-- | oop1w1/Opteller.cpp | 13 | ||||
-rw-r--r-- | oop1w1/Opteller.h | 12 | ||||
-rw-r--r-- | oop1w1/main.cpp | 24 | ||||
l--------- | oop1w1/makefile | 1 |
4 files changed, 50 insertions, 0 deletions
diff --git a/oop1w1/Opteller.cpp b/oop1w1/Opteller.cpp new file mode 100644 index 0000000..41efee0 --- /dev/null +++ b/oop1w1/Opteller.cpp @@ -0,0 +1,13 @@ +#include "Opteller.h" + +void Opteller::initialiseer() { + som = 0; +} + +void Opteller::voegWaardeToe(int waarde) { + som += waarde; +} + +int Opteller::geefSom() { + return som; +} diff --git a/oop1w1/Opteller.h b/oop1w1/Opteller.h new file mode 100644 index 0000000..2f21d79 --- /dev/null +++ b/oop1w1/Opteller.h @@ -0,0 +1,12 @@ +#pragma once + +class Opteller { + private: + int som; + + public: + void initialiseer(); + void voegWaardeToe(int waarde); + int geefSom(); +}; + diff --git a/oop1w1/main.cpp b/oop1w1/main.cpp new file mode 100644 index 0000000..0d895f4 --- /dev/null +++ b/oop1w1/main.cpp @@ -0,0 +1,24 @@ +/*
+ * Do not adapt this file!!!
+ */
+
+
+#include "Opteller.h"
+#include <iostream>
+
+int main()
+{
+ Opteller opteller;
+
+ opteller.initialiseer(); // zet som op 0
+ opteller.voegWaardeToe( 1 ); // tel 1 erbij
+ opteller.voegWaardeToe( 2 ); // tel 2 erbij
+ opteller.voegWaardeToe( 3 ); // tel 3 erbij
+ opteller.voegWaardeToe( 4 ); // tel 4 erbij
+ opteller.voegWaardeToe( 5 ); // tel 5 erbij
+
+ std::cout << opteller.geefSom() << std::endl; // toon de som
+ std::cin.get(); // wacht op <enter>
+
+ return 0;
+}
\ No newline at end of file diff --git a/oop1w1/makefile b/oop1w1/makefile new file mode 120000 index 0000000..a4e84c6 --- /dev/null +++ b/oop1w1/makefile @@ -0,0 +1 @@ +../week.mk
\ No newline at end of file |