English 中文(简体)
我何时应该使用宽松的等级? [闭门]
原标题:When should I use a nested class? [closed]
  • 时间:2011-11-03 09:13:24
  •  标签:
  • oop

我的班子是我写的单项活动,其中包括公开的课堂。 单轴心中,如事件、警报等部件的种类非常复杂,因此,让它们公开使用方案其他部分使用的课堂是明智的。

我已读过,开设公共开门课是不良方案规划的迹象。 为什么是坏的,什么时候是适当的开门课?

最佳回答

这是所有IMHO,但来自大约15年的对其他人的创造进行分析:

如果封门课是私人的,并且不受到装饰类别公共接口的影响,那是适当的。

例如,一个联系名单类别将有一个内部公布的、与执行内部具体相关的、但不会接触相关名单类别消费者的链接清单。

否则,我不会再说一遍,因为它只是增加了不必要的复杂性。

举例来说,如果一Cal事件类别暴露的话,我会改变你的所有阶层。

问题回答

暂无回答




相关问题
Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

JSON with classes?

Is there a standardized way to store classes in JSON, and then converting them back into classes again from a string? For example, I might have an array of objects of type Questions. I d like to ...

Object-Oriented Perl constructor syntax and named parameters

I m a little confused about what is going on in Perl constructors. I found these two examples perldoc perlbot. package Foo; #In Perl, the constructor is just a subroutine called new. sub new { #I ...

Passing another class amongst instances

I was wondering what is the best practice re. passing (another class) amongst two instances of the same class (lets call this Primary ). So, essentially in the constructor for the first, i can ...

Where can I find object-oriented Perl tutorials? [closed]

A Google search yields a number of results - but which ones are the best? The Perl site appears to contain two - perlboot and perltoot. I m reading these now, but what else is out there? Note: I ve ...

热门标签