Tag Info

New answers tagged


Class1 and Class2 should be something like: class Class1 { public: int i; Class1(int parameter) : i(parameter) {} // This is a constructor }; class Class2 { public: int i; void function(int parameter) {i = parameter;} // This is a init function }; and Class1 object1(10); Class2 object2; object2.function(10); The value of i will be the same: ...


I believe I've found the answer at cplusplus.com It looks like I was correct, but that I should also keep in mind that the 'constructor' is only called at creation of the object and can never be called again per that object, whereas a function within the class can be called repeatedly.


If your workout object is just a collection of data, why not make it a singleton. Alternatively you could implement it as android Service and start it in your activities. I personally would not implement it as fragment, as for me fragments are more of a UI thing (even although fragments can be headless).

Top 50 recent answers are included