OK, I want to make a pointer to a memberfunction of a class one of the arguments in a class's constructor. I do not know how however, here is as far as I have gotten
Function.h
1 2 3 4 5 6 7 8
//this function contains the member function that will be passed as a pointer
#include <iostream>
class Function
{
public:
void passedFunction(){ std::cout<<"this function is passed as a pointer"; }
};
ReceiveFunction.h
1 2 3 4 5 6 7 8 9 10 11 12
//this function takes a pointer to passedFunction() as an argument
class ReceiveFunction
{
public:
// I am unclear as to if this is correct or not
ReceiveFunction( ( * )() );//constructor that takes a pointer to a function
// pointer in which the function will be stored
void ( *receivedfunction )();
};
// initializes the objects in its constructor
class Function;// forward declarations
class ReceiveFunction;
class MakeObjects
{
public:
MakeObjects();// constructor
// make objects
Function function;
ReceiveFunction receivefunction;
};