We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 88dd626 commit 04ffa90Copy full SHA for 04ffa90
classes/advance-class-helloworld.cpp
@@ -0,0 +1,48 @@
1
+/**
2
+ * this is an extra step in classes
3
+*/
4
+
5
6
+// importing iostream header file :)
7
+#include <iostream>
8
9
10
+ * creating a class named myClass
11
+ */
12
13
+class myClass {
14
+public:
15
+ void helloworld()
16
+ {
17
+ std::cout << "hello world\n";
18
+ };
19
+};
20
21
22
+ * calling it in another void function
23
+ * for imporiving code clean
24
25
26
+void callbackfunction()
27
+{
28
+ myClass myObj;
29
30
+ myObj.helloworld();
31
+}
32
33
34
+ * calling the callbackfunction using a simple if loop
35
36
37
+int main()
38
39
+ int x = 10;
40
41
+ if (x == 10) {
42
+ callbackfunction();
43
+ } else {
44
+ std::cout << "oops i cant get the class ;(\n";
45
+ }
46
47
+ return 0;
48
0 commit comments