Originally Posted by
Desolation
int add(int, int);
float add(float, float);
double add(double, double);
long add(long, long);
C doesn't support function overloading, so you'd probably have to name them like addi, addf, addd, addld or just use the + operator instead.
I prefer C because the OO in C++ is ugly and other things like printf being prettier than cout as it first gives you a nice overview of the layout of things to be printed looking at the format string.
Code:
//C++ way
class coord {
int x, y, z;
public:
int getX (void)
{
return x;
}
int getY (void)
{
return y;
}
int getZ (void)
{
return z;
}
void setX (int _x)
{
x = _x;
}
void setY (int _y)
{
x = _y;
}
void setZ (int _z)
{
x = _z;
}
};
//C
typedef struct {
int x, y, z;
} coord;
Of course you could do it just as pretty as C but that's just not the OO way of doing things, everything has to be private for some reason and everyones seems to follow it as well.