功能重载 [英] Function Overloading
问题描述
在C中,你可以制作这样的函数:
int foo(int a);
int foo(int a,char b);
....
等
-
我只是海市蜃楼。
kelvSYC< ke ***** @ no.email.shaw.ca>写道:
在C中,你可以制作这样的函数:
int foo(int a);
int foo(int a,char b);
No.
-
我错过了什么吗?
--Dan Pop
问候。
文章< 02 ****** ******************@no.email.shaw.ca> ;, kelvSYC写道:在C中,你可以制作这样的函数: br />
int foo(int a);
int foo(int a,char b);
...
等。
不在标准C中,尽管您的编译器可能将此功能作为
非标准扩展提供。 C ++,你可能知道,它允许函数
多态。
-
_
_V.-o Tristan Miller [en,(fr,de,ia)]><空间有限
/ |` - '' - = - = - = - = - = - = - = - = - = - = - = - = - = - = - =<> ;在ha句中,所以很难
(7_ \\ http://www.nothingisreal.com/ ><完成你的内容
" Ben Pfaff" ;< bl*@cs.stanford.edu>在留言中写道
news:87 ************ @ pfaff.stanford.edu ...kelvSYC< ke ***** @ no.email.shaw.ca>写道:
在C中,你可以制作这样的函数:
int foo(int a);
int foo(int a,char b);
没有。
可悲的是没有!......选项?从printf系列中取得领先 -
变体名称和/或va_args,传递结构或使用C ++。
In C, can you make functions like this:
int foo(int a);
int foo(int a, char b);
....
etc.
--
I am only a mirage.
kelvSYC <ke*****@no.email.shaw.ca> writes:
In C, can you make functions like this:
int foo(int a);
int foo(int a, char b);
No.
--
"Am I missing something?"
--Dan Pop
Greetings.
In article <02************************@no.email.shaw.ca>, kelvSYC wrote:In C, can you make functions like this:
int foo(int a);
int foo(int a, char b);
...
etc.
Not in standard C, though your compiler may provide this functionality as a
non-standard extension. C++, as you''re probably aware, does allow function
polymorphism.
--
_
_V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
/ |`-'' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <> In a haiku, so it''s hard
(7_\\ http://www.nothingisreal.com/ >< To finish what you
"Ben Pfaff" <bl*@cs.stanford.edu> wrote in message
news:87************@pfaff.stanford.edu...kelvSYC <ke*****@no.email.shaw.ca> writes:In C, can you make functions like this:
int foo(int a);
int foo(int a, char b);
No.
Sadly not! ...... Options? Take a lead from the printf family -
variant names and/or va_args, pass a structure or use C++.
这篇关于功能重载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!