c++ - Assigning parameter value in function declaration? -
i don't understand why in constructor declaration, input parameter assigned 2. what mean? mean default (unless else passed), size 2? graph(int size = 2); i've never seen syntax this, don't know how google :/ thanks in advance! you're right, parameter value 2 default. so can call normally: graph g(5); in case size equal 5, or can call without providing value: graph g; in case size equal 2. note: graph g(); function declaration, not construction/initialization. c , c++ allow declare functions inside other functions. graph g(); declaration of function g takes no arguments , returns graph object value.