Question: Is it possible to link to c++ includes? I need to use the List template. If the dictionary is also available, that would be nice.
Yes - 3 (75%)
No - 0 (0%)
Maybe - 1 (25%)
Total Voters: 4

Pages: 1 2 [3]   Go Down
Author Topic: Linking to C++ includes, or having a Dictionary or List template?  (Read 2153 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can create a class that link a particular motor and speed value.

class motorWithSpeed
   int motorPin;
   int motorSpeed;

   motorWithSpeed(int pin);
   setSpeed(int speed);
   int getSpeed();

You can create an instance of that class:
motorWithSpeed speedy(3);

You can make that motor change speed:

You can later determine how fast the motor is going:
int speedySpeed = speedy.getSpeed();

Only the class instance maintains the speed.

OMG, I didn't think of using a class! (herpaderp) Thankyou paul! I will love you forever <3

Global Moderator
Offline Offline
Brattain Member
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You used the word "object" in your very first post. And C++.

C++ is basically an object-oriented language. Objects are created by classes.


An object is an instantiation of a class. In terms of variables, a class would be the type, and an object would be the variable.

Pages: 1 2 [3]   Go Up
Jump to: