It is not class.asset, it is object.asset.
Classes represent an outline for a "thing". Objects are instances of that thing.
For example, std::string is a class. You can have multiple strings by declaring them:
1 2 3
|
// a and b are two different strings
string a;
string b;
|
Here, a and b are "objects", the class is string.
Now, string has a member function, length, which gets the length. Proper usage is something like this:
1 2
|
int foo = a.length(); // get the length of our 'a' string.
foo = b.length(); // get the length of our 'b' string.
|
Note that before the dot (.) we put the
object that we want to act on. We do not put the class name. For example:
1 2
|
foo = string.length(); // this makes no sense. What string are we getting the length of?
// a? b? some other string?
|
Your Screen::StartScreen class has the same problem. There could be any number of screens:
1 2 3 4 5 6
|
// for example, say you had 2 screens:
Screen titlescreen;
Screen gamescreen;
// now, before, you were doing this
Screen.StartScreen(); // this makes no sense. Which screen are you starting?
|
This is why you were getting an error.
What static does in this case, is it makes a single function that is shared by ALL objects of the class. That way you don't call it with any single object. Therefore you use the Class::Function syntax:
1 2 3 4 5
|
// assuming StartScreen is static:
Screen::StartScreen();
// the above is similar in concept to this:
all_screens_in_your_program.StartScreen();
|
While this technically works the way you have it coded, you'll notice it doesn't make a whole lot of sense conceptually. Why and how would you draw all the screens in one function?
You probably don't want to use static here. Instead you would want to create an instance/object of your Screen class and call StartScreen with that object.