#include<stdio.h>
int fun(int x = 123, int y = 345, int z = 456)
{
printf("x %d y %d z %d\n", x, y, z);
}
struct sData
{
int x;
int y;
int z;
};
int sData*::fun(sData* self, int x = 123, int y = 345, int z = 456)
{
self.x = x;
self.y = y;
self.z = z;
}
void sData*::show(sData* self)
{
printf("x %d y %d z %d\n", self.x, self.y, self.z);
}
int main(int argc, char** argv)
{
fun(); // x 123 y 345 z 456 are outputed
fun(y:2); // x 123 y 2 z 456
fun(y:1, x:3); // x 3 y 1 z 456
fun(1); // x 1 y 345 z 456
fun(1,2); // x 1 y 2 z 456
sData data;
(&data).fun(1,2,3);
(&data).show(); // x 123 y 345 z 456
(&data).fun(y:2); // x 123 y 2 z 456
(&data).show(); // x 123 y 2 z 456
(&data).fun(1);
(&data).show(); // x 1 y 345 z 456
return 0;
}