From 8f7bf3c51fef0bd3915da6ac74094bf26d5b2f65 Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Sun, 19 Jun 2022 13:51:45 +0800 Subject: [PATCH 1/5] Committed 2022/06/19 --- Miscellaneous/Cpp/Pointer_to_object.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Miscellaneous/Cpp/Pointer_to_object.java diff --git a/Miscellaneous/Cpp/Pointer_to_object.java b/Miscellaneous/Cpp/Pointer_to_object.java new file mode 100644 index 0000000..db16922 --- /dev/null +++ b/Miscellaneous/Cpp/Pointer_to_object.java @@ -0,0 +1,22 @@ +package Cpp; + +class P_example { + private int num; + + void set_num(int val) { + num = val; + } + + void show_num() { + System.out.println(num); + } +} + +public class Pointer_to_object { + + public static void main(String[] args) { + // TODO Auto-generated method stub + + } + +} From c86048e6c20e5433b8104210451fac141fcd9c8b Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Sun, 19 Jun 2022 14:00:27 +0800 Subject: [PATCH 2/5] Committed 2022/06/19 --- Miscellaneous/Cpp/Pointer_to_object.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Miscellaneous/Cpp/Pointer_to_object.java b/Miscellaneous/Cpp/Pointer_to_object.java index db16922..3aaa764 100644 --- a/Miscellaneous/Cpp/Pointer_to_object.java +++ b/Miscellaneous/Cpp/Pointer_to_object.java @@ -16,6 +16,12 @@ public class Pointer_to_object { public static void main(String[] args) { // TODO Auto-generated method stub + + P_example objectives[] = new P_example[2]; + objectives[0].set_num(10); + objectives[1].set_num(20); + + objectives[0].show_num(); } From 1b65494b3e4fd9b8e80a03c5a9f0a5d9c565abd2 Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Sun, 19 Jun 2022 15:30:37 +0800 Subject: [PATCH 3/5] Committed 2022/06/19 --- Miscellaneous/Cpp/Pointer_to_object2.java | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Miscellaneous/Cpp/Pointer_to_object2.java diff --git a/Miscellaneous/Cpp/Pointer_to_object2.java b/Miscellaneous/Cpp/Pointer_to_object2.java new file mode 100644 index 0000000..07d7727 --- /dev/null +++ b/Miscellaneous/Cpp/Pointer_to_object2.java @@ -0,0 +1,29 @@ +package Cpp; + +class P_example2{ + private int num; + + void set_num(int val) { + num = val; + } + + void show_num() { + System.out.println(num); + } +} + +public class Pointer_to_object2 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + + int[] array_of_integer = new int[5]; + + P_example2[] objectives = new P_example2[2]; + + objectives[0] = new P_example2(); + objectives[0].set_num(10); + + } + +} From c367d00b43f37969b9b2a2c13fd3682330f03314 Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Sun, 19 Jun 2022 15:34:56 +0800 Subject: [PATCH 4/5] Committed 2022/06/19 --- Miscellaneous/Cpp/Pointer_to_object2.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Miscellaneous/Cpp/Pointer_to_object2.java b/Miscellaneous/Cpp/Pointer_to_object2.java index 07d7727..8784043 100644 --- a/Miscellaneous/Cpp/Pointer_to_object2.java +++ b/Miscellaneous/Cpp/Pointer_to_object2.java @@ -23,6 +23,7 @@ public static void main(String[] args) { objectives[0] = new P_example2(); objectives[0].set_num(10); + objectives[0].show_num(); } From 1dae7a6ac20566256558d4749283e56d76145de5 Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Sun, 19 Jun 2022 15:42:27 +0800 Subject: [PATCH 5/5] Committed 2022/06/19 --- Miscellaneous/Cpp/Pointer_to_object3.java | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Miscellaneous/Cpp/Pointer_to_object3.java diff --git a/Miscellaneous/Cpp/Pointer_to_object3.java b/Miscellaneous/Cpp/Pointer_to_object3.java new file mode 100644 index 0000000..416dfa4 --- /dev/null +++ b/Miscellaneous/Cpp/Pointer_to_object3.java @@ -0,0 +1,30 @@ +package Cpp; + +class P_example3{ + private int num; + + void set_num(int val) { + num = val; + } + + void show_num() { + System.out.println(num); + } +} + +public class Pointer_to_object3 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + + P_example3 objective[] = {new P_example3(), new P_example3()}; + + objective[0].set_num(10); + objective[0].show_num(); + + objective[1].set_num(20); + objective[1].show_num(); + + } + +}