Static member default argument
I got this code:
1 2 3 4 5 6 7
|
class Screenet{
public:
Screenet &clear(char = bkground);
private:
static const char bkground;
};
|
One thing i dont understand is this
Screenet &clear(char = bkground);
static object can be use as default argument but i dont know about
char=variable
So i declare bkground as char then I initiate a char via bkground? uhm im confused.
Can someone help me.
char is a reserved word. so im passing a bkground to a char? is that the case?
When you declare a function you can leave out the parameter name if you like.
|
void function(int paramName);
|
Specifying a default argument is no exception. You can still leave out the parameter name.
|
void function(int paramName = 123);
|
|
void function(int = 123);
|
Last edited on
SO how do you view that? int isnt a variable so does that mean function created a temporary variable as type int and pass 123?
It means that the default argument for the first parameter is 123.
Topic archived. No new replies allowed.