I have a question regarding classes in C++. As far as I've understood the built-in types like char, int, double are not classes. Whereas std::vector, std::string, std::map (for example) are classes(?), just as the classes we define ourselves. When working with classes in C++, we use the "."-notation to access members of the class. For example:
1 2 3 4 5 6 7
Class MyClass {
private:
int a;
public:
MyClass(int number) : a{number} {}
int getMyClassValue();
};
and
1 2
MyClass obj;
obj.getMyClassValue();
whereas for a string we can also use the "."-notation to use the member functions of the string class (like size(), length() etc..). So my question is: if you can use the "." on something in C++ that is not a self-defined class(like my MyClass example), is it then a class?
Yeah, thx. I kinda wrote that at the beginning of my post, altho I wasn't 100% sure. My question remains though: Is the "." reserved for accessing members of a class ?