Click here to Skip to main content
15,909,242 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Rogarding doubt C,C++,MFC Pin
Rajkumar R22-Feb-08 22:45
Rajkumar R22-Feb-08 22:45 
GeneralRe: Rogarding doubt C,C++,MFC Pin
rowdy_vc++22-Feb-08 22:51
rowdy_vc++22-Feb-08 22:51 
GeneralRe: Rogarding doubt C,C++,MFC PinPopular
Cranky22-Feb-08 23:03
Cranky22-Feb-08 23:03 
GeneralRe: Rogarding doubt C,C++,MFC Pin
rowdy_vc++22-Feb-08 23:05
rowdy_vc++22-Feb-08 23:05 
GeneralRe: Rogarding doubt C,C++,MFC Pin
CPallini22-Feb-08 23:14
mveCPallini22-Feb-08 23:14 
QuestionRe: Rogarding doubt C,C++,MFC Pin
Rajkumar R22-Feb-08 23:32
Rajkumar R22-Feb-08 23:32 
GeneralRe: Rogarding doubt C,C++,MFC Pin
Rajesh R Subramanian23-Feb-08 3:31
professionalRajesh R Subramanian23-Feb-08 3:31 
GeneralRe: Rogarding doubt C,C++,MFC Pin
Christian Graus23-Feb-08 12:43
protectorChristian Graus23-Feb-08 12:43 
GeneralRe: Rogarding doubt C,C++,MFC Pin
Cranky22-Feb-08 22:58
Cranky22-Feb-08 22:58 
GeneralRe: Rogarding doubt C,C++,MFC Pin
rowdy_vc++22-Feb-08 23:34
rowdy_vc++22-Feb-08 23:34 
GeneralRe: Rogarding doubt C,C++,MFC Pin
Cranky22-Feb-08 23:40
Cranky22-Feb-08 23:40 
GeneralRe: Rogarding doubt C,C++,MFC Pin
rowdy_vc++22-Feb-08 23:42
rowdy_vc++22-Feb-08 23:42 
GeneralRe: Rogarding doubt C,C++,MFC Pin
Christian Graus23-Feb-08 12:46
protectorChristian Graus23-Feb-08 12:46 
GeneralRe: Rogarding doubt C,C++,MFC Pin
Hamid_RT23-Feb-08 1:23
Hamid_RT23-Feb-08 1:23 
GeneralRe: Rogarding doubt C,C++,MFC Pin
Rajesh R Subramanian23-Feb-08 3:37
professionalRajesh R Subramanian23-Feb-08 3:37 
GeneralRe: Rogarding doubt C,C++,MFC Pin
David Crow24-Feb-08 13:26
David Crow24-Feb-08 13:26 
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 

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.