Click here to Skip to main content
15,898,957 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhow to use this lib? Pin
wendyyue22-Feb-08 22:36
wendyyue22-Feb-08 22:36 
AnswerRe: how to use this lib? Pin
CPallini22-Feb-08 22:59
mveCPallini22-Feb-08 22:59 
GeneralRe: how to use this lib? Pin
wendyyue22-Feb-08 23:17
wendyyue22-Feb-08 23:17 
GeneralRe: how to use this lib? Pin
CPallini23-Feb-08 8:06
mveCPallini23-Feb-08 8:06 
AnswerRe: how to use this lib? Pin
Rajkumar R23-Feb-08 2:41
Rajkumar R23-Feb-08 2:41 
GeneralRe: how to use this lib? Pin
wendyyue28-Feb-08 21:32
wendyyue28-Feb-08 21:32 
GeneralRe: how to use this lib? Pin
aquawicket14-Mar-08 12:28
aquawicket14-Mar-08 12:28 
Generalinvoke non-static function using :: [modified] Pin
George_George22-Feb-08 22:25
George_George22-Feb-08 22:25 
Hello everyone,


Confused why the following code can compile when we use :: to invoke non-static function. Especially, in the sample below, is it possible to call non-static member if T is not int? Why compiler allows the following code to compile?

(sorry that I have tried to use the code tag to format the code, but some template statement is not correct after using code tag, so I post the raw code here.)

template  <class T>
struct FooTrait {
public:
	int foo1();
};

template<>
struct FooTrait <int> {

	static int foo1() {cout << "Hello Foo1" << endl; return 0;}
};

template <class T1, class T2=FooTrait<T1>>
struct Foo {
public:
	int foo()
	{
		T2::foo1(); // possible to call non-static member if T is not int?

		return 0;
	}
};

 int main()
 {
	 Foo<int> f;
	 f.foo();
	 return 0;
 }


thanks in advance,
George

modified on Saturday, February 23, 2008 5:09 AM

modified on Saturday, February 23, 2008 5:48 AM

GeneralRe: invoke non-static function using :: Pin
CPallini22-Feb-08 22:52
mveCPallini22-Feb-08 22:52 
GeneralRe: invoke non-static function using :: Pin
George_George22-Feb-08 22:55
George_George22-Feb-08 22:55 
GeneralRe: invoke non-static function using :: Pin
Rajkumar R22-Feb-08 23:00
Rajkumar R22-Feb-08 23:00 
GeneralRe: invoke non-static function using :: Pin
George_George22-Feb-08 23:29
George_George22-Feb-08 23:29 
GeneralRe: invoke non-static function using :: Pin
Rajkumar R22-Feb-08 23:46
Rajkumar R22-Feb-08 23:46 
GeneralRe: invoke non-static function using :: Pin
George_George22-Feb-08 23:50
George_George22-Feb-08 23:50 
GeneralRe: invoke non-static function using :: Pin
CPallini22-Feb-08 23:08
mveCPallini22-Feb-08 23:08 
GeneralRe: invoke non-static function using :: Pin
George_George22-Feb-08 23:31
George_George22-Feb-08 23:31 
GeneralRe: invoke non-static function using :: Pin
George_George22-Feb-08 23:51
George_George22-Feb-08 23:51 
GeneralRe: invoke non-static function using :: Pin
Rajkumar R22-Feb-08 23:03
Rajkumar R22-Feb-08 23:03 
GeneralRe: invoke non-static function using :: Pin
George_George22-Feb-08 23:09
George_George22-Feb-08 23:09 
GeneralRe: invoke non-static function using :: Pin
Rajkumar R22-Feb-08 23:23
Rajkumar R22-Feb-08 23:23 
GeneralRe: invoke non-static function using :: Pin
George_George22-Feb-08 23:27
George_George22-Feb-08 23:27 
GeneralRe: invoke non-static function using :: Pin
Rajkumar R22-Feb-08 23:35
Rajkumar R22-Feb-08 23:35 
GeneralRe: invoke non-static function using :: Pin
George_George22-Feb-08 23:48
George_George22-Feb-08 23:48 
GeneralProblem when implement a class derived from CListCtrl which display image only (i.e. no label) [Updated] [modified] Pin
followait22-Feb-08 21:58
followait22-Feb-08 21:58 
QuestionHow can I browse filesystem in windows mobile device with SHBrowseForFolder Pin
fujoey22-Feb-08 20:46
fujoey22-Feb-08 20:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.