aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-11-28 10:40:48 +0100
committerlonkaars <loek@pipeframe.xyz>2022-11-28 10:40:48 +0100
commitdeeb409ab2b0e1aeeb5dcdc0f21ed2f2462298e5 (patch)
tree09b824e4af40af5dea774931c000d8df26cc7fe0
parentadb4076e576af4990051ff18f2afd017619d077e (diff)
fix class reference
-rw-r--r--oop2w3/A.cpp2
-rw-r--r--oop2w3/A.h2
-rw-r--r--oop2w3/B.cpp2
-rw-r--r--oop2w3/B.h2
-rw-r--r--oop2w4/main.cpp0
l---------oop2w4/makefile1
6 files changed, 5 insertions, 4 deletions
diff --git a/oop2w3/A.cpp b/oop2w3/A.cpp
index b6f0d57..ccdca46 100644
--- a/oop2w3/A.cpp
+++ b/oop2w3/A.cpp
@@ -18,7 +18,7 @@ void A::actie1(int n) {
}
}
-void A::setB(B b) {
+void A::setB(B &b) {
std::cout << "A::setB(b)" << std::endl;
_b = &b;
}
diff --git a/oop2w3/A.h b/oop2w3/A.h
index c0caae4..2882fe7 100644
--- a/oop2w3/A.h
+++ b/oop2w3/A.h
@@ -7,6 +7,6 @@ class A {
B* _b;
public:
A();
- virtual void setB(B b);
+ virtual void setB(B &b);
virtual void actie1(int n);
};
diff --git a/oop2w3/B.cpp b/oop2w3/B.cpp
index 6eb4bd2..42ae7de 100644
--- a/oop2w3/B.cpp
+++ b/oop2w3/B.cpp
@@ -3,7 +3,7 @@
#include "A.h"
#include "B.h"
-B::B(A a) {
+B::B(A &a) {
std::cout << "B::B(a)" << std::endl;
_a = &a;
_c = new C();
diff --git a/oop2w3/B.h b/oop2w3/B.h
index 081dc8b..a59a06f 100644
--- a/oop2w3/B.h
+++ b/oop2w3/B.h
@@ -8,7 +8,7 @@ class B {
A* _a;
C* _c;
public:
- B(A a);
+ B(A &a);
virtual void even();
virtual void odd(int i);
virtual void actie2(int i);
diff --git a/oop2w4/main.cpp b/oop2w4/main.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/oop2w4/main.cpp
diff --git a/oop2w4/makefile b/oop2w4/makefile
new file mode 120000
index 0000000..a4e84c6
--- /dev/null
+++ b/oop2w4/makefile
@@ -0,0 +1 @@
+../week.mk \ No newline at end of file