No worries, pleased to help :+)
There are quite a few very experienced, guru members on this site, just keep that in mind.
It's good you started coding already, it means you will have quite an advantage once you get to University, even though an introductory course might be in another language like Python or Java say. Once you have some experience in 1 language, it's much easier to pick up another. Five years is a good amount of time to get a really good grasp of 2 languages.
I strongly suggest that you post code here, even if it works and you are happy with it. There are people here that can pull code to bits, criticise every little thing, so you could
really learn a lot from that. There is a lot of bad code on the Internet and in books, and the C++ language is evolving all the time, and there are alternative ways of doing things, so might as well learn as much as possible about the best way to do things from the experts here. It's not only the code, but how one compiles it. There are other things like idioms and design patterns.
With classes, the simple idea is that they have some data members (
private:
access), and some functions that use that data.
Some of these functions are
public:
, they form the class' interface, the interface can exist in a base class too. Functions can be
protected:
or
private:
too, meaning they can be used only by derived classes, or only by the class itself.
Classes can also have overloaded operators, meaning for example one can provide ones own function to carry out the + operation for your object. So if you has a
Point
class, you can provide operators to add, subtract, scalar multiply, cross and dot products. Another example is the
std::string
class, one of the operators it has is the
operator+
so one can concatenate (join together) strings with it.
Finally there are sites like Project Euler which has some 500 coding challenges, starting out easy and getting harder. Usually brute force is not the way, there will be some method of making life easier, even for the very first problem - there is a formula to use, one you may not have thought of. So this could be an excellent learning resource, get that thinking cap on, set brain mode to clever with lateral thinking.
https://projecteuler.net/about
https://projecteuler.net/archives