D
dennis luehring
i try to "publish" some of my very stupid methods (i need this for an interpreter)
function_one
procedure_one
here is the code
---------
class core
{
public:
int result;
int parameter[2];
typedef void(core::*call)();
typedef struct method_t
{
bool function; // additional information
call method; // the call
};
method_t methods[2];
core()
{
methods[0].function = true;
methods[0].method = function_one;
methods[1].function = false;
methods[1].method = procedure_one;
}
// callable methods
void function_one(){ result = parameter[0] + parameter[1]; }
void procedure_one(){ parameter[0] = 10; }
};
void main()
{
core c;
// why can't i call the method...
//c.methods[0].method();
// can't compile this - error
// error C2064: term does not evaluate to a function taking 0 arguments
// ...should be the same as
c.function_one();
}
function_one
procedure_one
here is the code
---------
class core
{
public:
int result;
int parameter[2];
typedef void(core::*call)();
typedef struct method_t
{
bool function; // additional information
call method; // the call
};
method_t methods[2];
core()
{
methods[0].function = true;
methods[0].method = function_one;
methods[1].function = false;
methods[1].method = procedure_one;
}
// callable methods
void function_one(){ result = parameter[0] + parameter[1]; }
void procedure_one(){ parameter[0] = 10; }
};
void main()
{
core c;
// why can't i call the method...
//c.methods[0].method();
// can't compile this - error
// error C2064: term does not evaluate to a function taking 0 arguments
// ...should be the same as
c.function_one();
}