diff --git a/CM2005 Object Oriented Programming/Topic 4/4.3.1/a.exe b/CM2005 Object Oriented Programming/Topic 4/4.3.1/a.exe new file mode 100644 index 0000000..c339dbb Binary files /dev/null and b/CM2005 Object Oriented Programming/Topic 4/4.3.1/a.exe differ diff --git a/CM2005 Object Oriented Programming/Topic 4/4.3.1/topic4.cpp b/CM2005 Object Oriented Programming/Topic 4/4.3.1/topic4.cpp new file mode 100644 index 0000000..b6c5b98 --- /dev/null +++ b/CM2005 Object Oriented Programming/Topic 4/4.3.1/topic4.cpp @@ -0,0 +1,23 @@ +#include +#include +#include + +//using namespace std; + +int main() +{ + //vector a; + std::vector strings; + strings.push_back("one"); + strings.push_back("two"); + strings.push_back("three"); + // we use const because we won't mutate the data in the s variable + // Because we're only reading, we don't want to create a copy + // so we use a reference '&' instead + for (const std::string& s:strings) + { + std::cout << s << std::endl; + std::string lel = "lol"; + //s.append(lel); // we can't use this because s is of type const + } +} \ No newline at end of file