1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
class Function_Class {
public:
double (*Left)(vector< double > &x, double &phi, vector< double > &dphidx,
double &u, vector< double > &dudx);
double (*Right)(vector< double > &x, double &phi, vector< double > &dphidx,
double &u, vector< double > &dudx);
double Complete(vector< double > &x, double &phi, vector< double > &dphidx,
double &u, vector< double > &dudx) {
return Left(x, phi, dphidx, u, dudx) - Right(x, phi, dphidx, u, dudx);
};
};
int main() {
// Create an object of type Function_Class
Function_Class c;
// Modify the object:
c.Left = [](vector< double > &x, double &phi, vector< double > &dphidx,
double &u, vector< double > &dudx)
-> double // If you don't specify the return type, it will be deduced from
// the return statement (as int)
{ return 2; };
return 0;
}
|