Talk:Inner class
| This article is rated Stub-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
This article may be too technical for most readers to understand. (September 2010) |
Pyrofysh 11:17, 18 December 2005 (UTC)
Untitled
This article needs a discussion of how inner classes are used in other languages - esp C++. And what the differences are, with specific examples.
Scala
Scala supports a more semantically meaningful form of nested classes with type-dependent paths. It probably has the most sophisticated nested class of any language today with a significant number of users. —Preceding unsigned comment added by 64.134.134.22 (talk) 22:14, 28 March 2011 (UTC)
Section 3 (Why can't inner classes have static members)
This section is written in broken English and looks like it may have been copied and pasted here from a blog site or mailing list. Either the original source should be identified and the copy cleaned up, or the section should be eliminated outright. 69.180.197.51 (talk) 14:23, 3 November 2011 (UTC)
What is this article about: nested classes or inner classes?
The first paragraph currently says "In object-oriented programming (OOP), an inner class or nested class is a class declared entirely within the body of another class or interface. It is distinguished from a subclass." So this suggests that "inner class" and "nested class" are synonyms (which I don't think they are). Later the article says there are (in Java) 4 kinds of nested classes, of which 3 are "inner classes". I.e., it is implied that an inner class (in Java) is a nonstatic nested class (which I think is right). If the article's title were changed to "nested classes" and the first sentence dropped the words "inner class or", then it would (a) be self consistent and (b) agree with the use of the words "nested" and "inner" in the Java literature. Also I think it is a no-brainer that the section entitled "Types of inner classes" should be called "Types of nested classes". I'm just going to go ahead and change that. Theodore.norvell (talk) 19:47, 12 March 2013 (UTC)
Remove Ruby from the article
I suggest removing any mention of Ruby from the article. Defining a class inside of another class definition is purely syntactical and does not create any relationship between the two classes. It simply makes the constant which refers to the "nested" class namespaced to the "outer" class, but that relationship is between the constant and the outer class, not the inner class and the outer class.
In general, the article seems to focus too much on the syntactic property of a class being syntactically defined inside of another class definition, instead of the semantic property of there being a containment relationship not only between the outer and nested class but also between instances of the outer class and the nested class.
Note: it would be possible to emulate nested classes in Ruby, by using methods that return classes:
class Outer
def Inner
@__inner__ ||= Class.new do
# contents of inner class
end
end
end
But that′s certainly not a recognized idiom in the Ruby community.
jwmittag (talk) 08:57, 30 July 2014 (UTC)
Use of inner classes vs. standalone classes
The "GUI code" section is rather subjective, especially the last paragraph using weasel words such as "messy", "better", and "considered." It's true that inner classes are common in Java, especially as event handlers, but that simply means this is a commonly used convention. There are many cases where using standalone classes is preferable.
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.
