默认参数指定不允许 [英] Default parameter specifiers are not permitted
本文介绍了默认参数指定不允许的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下的code,让错误
默认参数指定不允许
这怎么能解决吗?
布尔listSubscribe(字符串apikey,
字符串ID,
串EMAIL_ADDRESS,
字符串[] merge_vars,
字符串email_type =HTML,
布尔double_optin =假,
布尔replace_interests = TRUE,
布尔send_welcome = FALSE);
布尔listUnsubscribe(字符串apikey,
字符串ID,
串EMAIL_ADDRESS,
布尔delete_menber =假,
布尔send_goodbye = TRUE,
布尔send_notify = TRUE);
解决方案
根据你的错误信息,你可以这样做,在v3.5版本。
解决方法是多个构造函数:
布尔listUnsubscribe(字符串apikey,
字符串ID,
串EMAIL_ADDRESS){
返回listUnsubscribe(apikey,ID,EMAIL_ADDRESS,假的,真正的,真实的);
}
布尔listUnsubscribe(字符串apikey,
字符串ID,
串EMAIL_ADDRESS,
布尔delete_menber,
布尔send_goodbye,
布尔send_notify){
返回什么;
}
I have the following code that gives the error
Default parameter specifiers are not permitted
How can this be fixed?
bool listSubscribe(string apikey,
string id,
string email_address,
string [] merge_vars,
string email_type="html",
bool double_optin=false,
bool replace_interests=true,
bool send_welcome=false);
bool listUnsubscribe(string apikey,
string id,
string email_address,
bool delete_menber=false,
bool send_goodbye=true,
bool send_notify=true);
解决方案
As per your error message, you can't do that in v3.5.
The work around is multiple constructors:
bool listUnsubscribe(string apikey,
string id,
string email_address) {
return listUnsubscribe(apikey, id, email_address, false, true, true);
}
bool listUnsubscribe(string apikey,
string id,
string email_address,
bool delete_menber,
bool send_goodbye,
bool send_notify) {
return whatever;
}
这篇关于默认参数指定不允许的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文