I think this comes close to what OP wants...
You could do the same in other ways, but using a class may allow additions that can only be done with classes...
class triangle {
public:
static float surface(float height, float base);
};
float triangle::surface(float height, float base) {
return height * base * 0.5;
}
void setup {
Serial.begin(9600);
Serial.println(triangle::surface(10, 10));
}
void loop() {
}
I tested the code in Xcode (C++ on Mac) and adopted it to Arduino code without testing...