diff --git a/CM2005 Object Oriented Programming/Topic 3/3.5.1/a.exe b/CM2005 Object Oriented Programming/Topic 3/3.5.1/a.exe new file mode 100644 index 0000000..8b38bf8 Binary files /dev/null and b/CM2005 Object Oriented Programming/Topic 3/3.5.1/a.exe differ diff --git a/CM2005 Object Oriented Programming/Topic 3/3.5.1/static.cpp b/CM2005 Object Oriented Programming/Topic 3/3.5.1/static.cpp new file mode 100644 index 0000000..4835d77 --- /dev/null +++ b/CM2005 Object Oriented Programming/Topic 3/3.5.1/static.cpp @@ -0,0 +1,12 @@ +#include +#include + +int main() +{ + std::string s = "Matthew"; + std::cout << "Length of the string is " << s.length() << std::endl; // .length is stateful + // the life of a stateful function ends with the object that it belongs to + + // static or non-stateful function, they use memory and then return it + std::cout << std::stod("100") << std::endl; +} \ No newline at end of file