Last change
on this file since 2618 was 2283, checked in by plaszczy, 23 years ago |
ajout de classfunc et changements dans integ pour que ca colle
|
File size:
681 bytes
|
Line | |
---|
1 | ////////////////////////////////////////////////////////////////
|
---|
2 | //this class provides an alernative to functions which can be viewed as classes
|
---|
3 | // S.Plaszczynski 29/11/02
|
---|
4 | //////////////////////////////////////////////////////////////////////
|
---|
5 |
|
---|
6 |
|
---|
7 | #ifndef CLASSFUNC_H
|
---|
8 | #define CLASSFUNC_H
|
---|
9 |
|
---|
10 | namespace SOPHYA {
|
---|
11 |
|
---|
12 | //abstract class-function
|
---|
13 | class ClassFunc {
|
---|
14 | public:
|
---|
15 | virtual double operator()(double x)=0;
|
---|
16 | };
|
---|
17 |
|
---|
18 | //ClassFunc constructed from a a function:simple forward to function
|
---|
19 | class Function : public ClassFunc {
|
---|
20 | private:
|
---|
21 | double (*f)(double);
|
---|
22 | public:
|
---|
23 | Function(double (*g)(double)):f(g){}
|
---|
24 | inline double operator()(double x){ return f(x);}
|
---|
25 | };
|
---|
26 |
|
---|
27 | }
|
---|
28 |
|
---|
29 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.