summaryrefslogtreecommitdiff
path: root/7p58.cpp
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-10-03 12:20:34 +0200
committerOskar <[email protected]>2024-10-03 12:20:34 +0200
commit2f1ad9ec273a0ff9e746e9f6c4cac2ce81cb31e4 (patch)
treea397e770261ea84eedbea851fd051210246f4a10 /7p58.cpp
parent3edb35c6cab27d36f0fde49726db8cc9289e7304 (diff)
small test to play around abit with classes
Diffstat (limited to '7p58.cpp')
-rw-r--r--7p58.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/7p58.cpp b/7p58.cpp
new file mode 100644
index 0000000..ac94db8
--- /dev/null
+++ b/7p58.cpp
@@ -0,0 +1,38 @@
+#include <iostream>
+#include <vector>
+
+/*
+ *
+ * 7.58
+ *
+ *
+ */
+
+class Example {
+public:
+ static double rate; // Cannot be initialized here
+ static const int vecSize = 20;
+ static std::vector<double> vec; // Cannot be initialized here
+};
+
+// We initialize them here instead
+double Example::rate = 20;
+std::vector<double> Example::vec(vecSize);
+int main () {
+
+ /*
+ // example.h
+ class Example {
+ public:
+ static double rate = 6.5;
+ static const int vecSize = 20;
+ static vector<double> vec(vecSize);
+ };
+
+ // example.C
+ #include "example.h"
+ double Example::rate;
+ vector<double> Example::vec;
+ */
+ return 0;
+}