diff options
author | Oskar <[email protected]> | 2024-09-26 14:35:42 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-09-26 14:35:42 +0200 |
commit | b0b9d83b2baae38be742fc21ec60bde794d3eedd (patch) | |
tree | eb837b672113c21cf9bcff54aa6095d796dc3893 | |
parent | 88f7c0cfde5bb7d5cb310dad788dce23382a249f (diff) |
more
-rw-r--r-- | 7p34.cpp | 14 | ||||
-rw-r--r-- | 7p35.cpp | 32 |
2 files changed, 46 insertions, 0 deletions
diff --git a/7p34.cpp b/7p34.cpp new file mode 100644 index 0000000..680fa7d --- /dev/null +++ b/7p34.cpp @@ -0,0 +1,14 @@ + +/* + * + * 7.34 + * + * + */ + +int main () { + + // The type would be private so we wouldnt be able to use it outside the class + // The type would be declared after all the variables using it and that gives a compiler error (for me) + return 0; +} diff --git a/7p35.cpp b/7p35.cpp new file mode 100644 index 0000000..094d1df --- /dev/null +++ b/7p35.cpp @@ -0,0 +1,32 @@ +#include <iostream> + +/* + * + * 7.35 + * + * + */ + +typedef std::string Type; +Type initVal(); +class Exercise { +public: + typedef double Type; + Type setVal(Type); // double / double + Type initVal(); // double +private: + int val; +}; + +Exercise::Type Exercise::setVal(Exercise::Type parm) { + val = parm + initVal(); // double initVal() is used + return val; // Return val as double? +} + +Exercise::Type Exercise::initVal() { + return 0; +} + +int main () { + return 0; +} |