From b0b9d83b2baae38be742fc21ec60bde794d3eedd Mon Sep 17 00:00:00 2001 From: Oskar Date: Thu, 26 Sep 2024 14:35:42 +0200 Subject: more --- 7p34.cpp | 14 ++++++++++++++ 7p35.cpp | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 7p34.cpp create mode 100644 7p35.cpp 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 + +/* + * + * 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; +} -- cgit v1.2.3