+ 12

How to call function via pointer in (C++)?

I am stuck trying to call the fuction using pointer. Code is given below ..Just fill the question marked places. Thank you class test{ public: void foo(){ } }; test* myPtr = new test(); myPtr??foo();

22nd Sep 2017, 4:15 AM
Abhishek Pun
Abhishek Pun - avatar
2 Respuestas
+ 4
-> #include <iostream> using namespace std; class test{ public: void foo(){ cout<<"bar"; } }; int main() { test* myPtr = new test(); myPtr->foo(); return 0; }
22nd Sep 2017, 4:32 AM
ChaoticDawg
ChaoticDawg - avatar
+ 12
Thanks
22nd Sep 2017, 4:35 AM
Abhishek Pun
Abhishek Pun - avatar