diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-11-28 10:40:48 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-11-28 10:40:48 +0100 |
commit | deeb409ab2b0e1aeeb5dcdc0f21ed2f2462298e5 (patch) | |
tree | 09b824e4af40af5dea774931c000d8df26cc7fe0 | |
parent | adb4076e576af4990051ff18f2afd017619d077e (diff) |
fix class reference
-rw-r--r-- | oop2w3/A.cpp | 2 | ||||
-rw-r--r-- | oop2w3/A.h | 2 | ||||
-rw-r--r-- | oop2w3/B.cpp | 2 | ||||
-rw-r--r-- | oop2w3/B.h | 2 | ||||
-rw-r--r-- | oop2w4/main.cpp | 0 | ||||
l--------- | oop2w4/makefile | 1 |
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; } @@ -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(); @@ -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 |