When writing inline functions when defining classes, if i have a simple "get function" that only returns something, I normally define it in one line like this:
1 2 3 4 5 6 7
//this is just a short example, not an excerpt from my code
class Circle {
private:
double radius;
public:
void getArea() { return 3.14 * pow(radius, 2); }
};
Is this bad practice? I am asking because though it is discouraged to write code in one line like that, this seems more readable than any other way to define it in multiple lines, at least to me.