I have just came across a class for the first time ever that does not have variables in any of it's declarations but has them in the implementation. Why is this class behaviour allowed? What are the benefits of not putting variable names?

class Testing
{
    public:
        Testing(int, int, int);     //<--- Why is there no variables after int?
};

Testing::Testing(int X, int Y, int Z)   //<--- Variables here.
{
}

Is it the intellisense? I don't use intellisense so I want to know if it affects it and what makes a programmer do this? Benefits? Why does this even compile :S It works but I have no clue why.

Here, this should help you. Look at the definition of the constructor.

Parameter names aren't required in a function declaration, though it's generally viewed as poor style to take advantage of that (mis)feature. You can also omit the parameter name if you don't use the parameter, even if it's a definition, which can be useful every now and again to match interfaces:

// Match an expected interface of 3 arguments, but we don't use the 3rd
int add(int x, int y, int)
{
    return x + y;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.