From 2f1ad9ec273a0ff9e746e9f6c4cac2ce81cb31e4 Mon Sep 17 00:00:00 2001 From: Oskar Date: Thu, 3 Oct 2024 12:20:34 +0200 Subject: small test to play around abit with classes --- 7p58.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 7p58.cpp (limited to '7p58.cpp') 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 +#include + +/* + * + * 7.58 + * + * + */ + +class Example { +public: + static double rate; // Cannot be initialized here + static const int vecSize = 20; + static std::vector vec; // Cannot be initialized here +}; + +// We initialize them here instead +double Example::rate = 20; +std::vector Example::vec(vecSize); +int main () { + + /* + // example.h + class Example { + public: + static double rate = 6.5; + static const int vecSize = 20; + static vector vec(vecSize); + }; + + // example.C + #include "example.h" + double Example::rate; + vector Example::vec; + */ + return 0; +} -- cgit v1.2.3