Prev: Static var in mixed C/C++ program. do you recommend?
Next: Keeping types and functions in separate namespaces
From: Seungbeom Kim on 1 Apr 2010 06:54 On 2010-04-01 07:20, DeMarcus wrote: > Seungbeom Kim wrote: >> On 2010-03-30 08:49, DeMarcus wrote: >>> >>> class SomeClass >>> { >>> public: >>> >>> void fnc( int& a ); >>> void fnc( int& a, int& b ); >>> void fnc( int& a, int& b, int& c ); >>> >>> // Now insert a pointer if we want to disable (b). >>> void fnc( int& a, int* b, int& c ); >>> }; >> >> Doesn't the last overload have to deal with non-null values of b anyway? >> Then I don't see the value of having the third overload separately. >> > > The point is that the last overload allows us to write > fnc( a, NULL, c ); > which the others don't. The point is that in the last overload we don't > use b, why it's important that we could check in compile time that b for > sure is NULL (if it's possible). You missed the point. I asked: "Doesn't the last overload have to deal with non-null values of b anyway?" in other words, shouldn't fnc(a, &b, c) be the same as fnc(a, b, c)? Then we have a redundancy; we could just do without the third overload entirely. -- Seungbeom Kim [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
First
|
Prev
|
Pages: 1 2 3 4 Prev: Static var in mixed C/C++ program. do you recommend? Next: Keeping types and functions in separate namespaces |