Files
UoL/CM2005 Object Oriented Programming/Topic 4/4.3.1/topic4.cpp
2021-05-26 17:02:26 -05:00

23 lines
587 B
C++

#include <iostream>
#include <vector>
#include <string>
//using namespace std;
int main()
{
//vector<string> a;
std::vector<std::string> 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
}
}