//int64_t sumArray(vector<int> newA);
int setAndGetA(int newA);
int setACAndGetA(string newC, int newA);
- //void registerCallback(CallBackInterface _cb);
- //int callBack();
+ void registerCallback(CallBackInterface* _cb);
+ void registerCallback(vector<CallBackInterface*> _cb);
+ int callBack();
private:
- int intA;
- float floatB;
- string stringC;
- //CallBackInterface cb;
+ int intA;
+ float floatB;
+ string stringC;
+ CallBackInterface *cb;
+ vector<CallBackInterface*> cbvec;
};
intA = 1;
floatB = 2;
stringC = "345";
- //cb = NULL;
+ cb = NULL;
+ // cbvec doesn't need to be initialized again
}
intA = _int;
floatB = _float;
stringC = _string;
- //cb = NULL;
+ cb = NULL;
+ // cbvec doesn't need to be initialized again
}
}
-/*void TestClass::registerCallback(CallBackInterface _cb) {
+void TestClass::registerCallback(CallBackInterface* _cb) {
cb = _cb;
}
+void TestClass::registerCallback(vector<CallBackInterface*> _cb) {
+
+ for (CallBackInterface* cb : _cb) {
+ cbvec.push_back(cb);
+ cout << "Registering callback object!" << endl;
+ }
+}
+
+
+//int TestClass::callBack() {
+// return cb.printInt();
+//}
+
+
int TestClass::callBack() {
- return cb.printInt();
-}*/
+ int sum = 0;
+ for (CallBackInterface* cb : cbvec) {
+ sum = sum + cb->printInt();
+ }
+}