Skip to content
Snippets Groups Projects
Commit 63c2caed authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Make functions virtual

parent 095fc4ab
No related branches found
No related tags found
No related merge requests found
......@@ -14,22 +14,26 @@ class NiceFunction : public VirtualFunction<double, double> {
class SampleFunction : public NiceFunction {
public:
void evaluate(const double& x, double& y) const {
void virtual evaluate(const double& x, double& y) const {
y = (x < 1) ? x : (2 * x - 1);
}
double leftDifferential(const double s) const { return (s <= 1) ? 1 : 2; }
double virtual leftDifferential(const double s) const {
return (s <= 1) ? 1 : 2;
}
double rightDifferential(const double s) const { return (s < 1) ? 1 : 2; }
double virtual rightDifferential(const double s) const {
return (s < 1) ? 1 : 2;
}
};
class TrivialFunction : public NiceFunction {
public:
void evaluate(const double& x, double& y) const { y = 0; }
void virtual evaluate(const double& x, double& y) const { y = 0; }
double leftDifferential(const double) const { return 0; }
double virtual leftDifferential(const double) const { return 0; }
double rightDifferential(const double) const { return 0; }
double virtual rightDifferential(const double) const { return 0; }
};
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment