为什么有这么多的内部类中的Andr​​oid? [英] Why so many inner classes in Android?

查看:120
本文介绍了为什么有这么多的内部类中的Andr​​oid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android开发一个新的鱼。在阅读书籍和Android源$ C ​​$ C我在Android应用程序发现有这么多的内部类。为什么Android的需要这么多的内部类?

I am a new fish in Android development. While reading books and Android source code I found out that there so many inner classes in the Android application. Why does Android need so many inner classes?

我对这些内部类混淆。

推荐答案

它们往往是实现设计的最有效的方式。

They are often the most efficient way of implementing a design.

这是内部类可以访问包含它,所以用一个内部类的类的私有成员允许类之间的功能分割,而不需要增加对私有变量的访问方法。

An inner class can access the private members of the class which contains it, so using an inner class allows a split of functionality between classes without the need to add accessor methods for private variables.

这篇关于为什么有这么多的内部类中的Andr​​oid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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