+ 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();
2 Answers
+ 4
->
#include <iostream>
using namespace std;
class test{
public:
void foo(){
cout<<"bar";
}
};
int main() {
test* myPtr = new test();
myPtr->foo();
return 0;
}
+ 12
Thanks