本文介绍了功能重载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C中,你可以制作这样的函数:


int foo(int a);

int foo(int a,char b);

....




-

我只是海市蜃楼。

解决方案




No.

-

我错过了什么吗?

--Dan Pop





不在标准C中,尽管您的编译器可能将此功能作为

非标准扩展提供。 C ++,你可能知道,它允许函数

多态。


-

_

_V.-o Tristan Miller [en,(fr,de,ia)]><空间有限

/ |` - '' - = - = - = - = - = - = - = - = - = - = - = - = - = - = - =<> ;在ha句中,所以很难

(7_ \\ ><完成你的内容




没有。




可悲的是没有!......选项?从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.

解决方案



No.
--
"Am I missing something?"
--Dan Pop




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




No.



Sadly not! ...... Options? Take a lead from the printf family -
variant names and/or va_args, pass a structure or use C++.


这篇关于功能重载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 19:23