是默认参数在OOP不好的做法? [英] Are default parameters bad practice in OOP?

查看:135
本文介绍了是默认参数在OOP不好的做法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

执行默认参数的方法破坏了封装?

Do default parameters for methods violate Encapsulation?

什么是落后在C#中没有提供缺省参数的理由?

What was the rationale behind not providing default parameters in C#?

推荐答案

我想借此这个从微软官方的答案。然而,默认值(和命名)参数的最肯定是在C#4.0提供。

I would take this as the "official" answer from Microsoft. However, default (and named) parameters will most definitely be available in C# 4.0.

这篇关于是默认参数在OOP不好的做法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆