classes

class MyClass {
public:
MyClass();
virtual ~MyClass();

// Variables
sf::Clock mClock1;
MyStuff::Clock mClock2;
};

What would be the point of this?

How would you possibly manipulate sf::Clock with this?

would you say

myclass();

or
mClock1;
or mClock2;
?

I'm fairly new t classes i skipped them in the tutorials. And the tutorial on this site i don't understand very well.
How would you possibly manipulate sf::Clock with this?


Your question makes no sense. You don't manipulate sf::Clock. You manipulate the object of type sf::Clock named mClock1.

It's a class member, so you first have to make an instacne of the class
MyClass someInstance;
and then you can do things with its members
doSomething(someInstance.mClock1);

What would be the point of this?
What's the point of classes? Well, sometimes in programming you find that the built in data typers, such as int and double, don't do everything you need. So you define your own new kinds of objects. In C++, we call these classes (or structs).
Last edited on
Topic archived. No new replies allowed.