Hi I was just wondering in arduino land how you create an instance if a class inside a class?
I have a class that inherits from stepper and inside it I'd like it to be responsible for creating an instance and holding a reference to an instance of another custom class as well as some inbuilt library classes..
Does anyone have a decent tutorial on doing this? I come from Java land
Thomen:
Hi I was just wondering in arduino land how you create an instance if a class inside a class?
I have a class that inherits from stepper and inside it I'd like it to be responsible for creating an instance and holding a reference to an instance of another custom class as well as some inbuilt library classes..
Does anyone have a decent tutorial on doing this? I come from Java land
You want to learn about inheritance, or how to create an object in a class?
If your class member object touches hardware, just be sure to create an initializing member function to call in setup() (or run time instantiation) to do that work(i.e. Serial.begin()).
BulldogLowell:
You want to learn about inheritance, or how to create an object in a class?
If your class member object touches hardware, just be sure to create an initializing member function to call in setup() (or run time instantiation) to do that work(i.e. Serial.begin()).
That is ONLY needed if you're creating a global instance of the class...