have an issue with pointer on function,i want to create a pointer on function but when i'm trying to point on which function pointer must points appears an error with next text: A value of type "void (Test::)()" cannot be assigned to an entity of type "void ()()" . Here is my code:
testh.h:
#pragma once
#include<iostream>
using namespace std;
class Test {
public:
Test();
void hello();
void goodBye();
~Test();
private:
void(*b1)();
void(*b2)();
void(*functPtrs[1])();
};
test.cpp:
#include"testh.h"
Test::Test() {
b1 = hello;
b2 = goodBye;
functPtrs[0] = b1;
functPtrs[1]=b2;
}
void Test::hello() {
cout << "hello" << endl;
}
void Test::goodBye() {
cout << "Goodbye" << endl;
}
Test::~Test() {
}
Thanks in advance