Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Return type of ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 9781 of 10094
Post > Topic >>

Return type of a function

by anubhav.saxena@[EMAIL PROTECTED] Jul 11, 2008 at 02:18 PM

Hi,

Consider the code below.

typedef double T;

class A{
public:
	typedef int T;
	T fn(T t);
};

T A::fn(T t){
	return T();
}

int main(){
	A a;
	a.fn(0);
}

This program is ill-formed, because the return type of the function
declaration A::fn is int, but when it is defined outside of the class
declaration, the type of return type is double.

However I am not clear on which section of the C++ standard talks
about this behaviour. Please guide me.

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 4 Posts in Topic:
Return type of a function
anubhav.saxena@[EMAIL PRO  2008-07-11 14:18:37 
Re: Return type of a function
Oncaphillis <oncaphill  2008-07-11 18:27:07 
Re: Return type of a function
=?UTF-8?B?RXJpayBXaWtzdHL  2008-07-11 18:26:40 
Re: Return type of a function
Alberto Ganesh Barbati &l  2008-07-14 23:10:28 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 13 9:06:52 CDT 2008.