Quote:Original post by _Sigma
and why is ittest::returnAB( t ); // returns 40
Can it be? cheers!test.returnAB( t ); // returns 40,
No. test is a namespace, and as such uses the namespace resolution operator.
CM
Quote:Original post by _Sigma
and why is ittest::returnAB( t ); // returns 40
Can it be? cheers!test.returnAB( t ); // returns 40,
Quote:Original post by Conner McCloudQuote:Original post by _Sigma
and why is it test::returnAB( t ); // returns 40
Can it be test.returnAB( t ); // returns 40,? cheers!
No. test is a namespace, and as such uses the namespace resolution operator.
CM
static int returnAB( const test *instance ) { return instance->a * b;}
test t( 2 );test::returnAB( &t );
Quote:Original post by _Sigma
how did that become a namespace? :S
Quote:Original post by Conner McCloudQuote:Original post by _Sigma
how did that become a namespace? :S
All classes have a namespace [of the same name] associated with them.
CM