| Share this post! | Vote this! |
|
Inner classes let you define one class within another, they provide a
type of scoping for your classes since you can make one class a member
of another class. This web page discusses four types of inner class
Normally when you are programming a class should have code only for the things an object of that particular type needs to do, any other behavior should be part of another class better suited for that job. Sometimes though you design a class that has different behavior but also needs to be intimately tied to the class you're designing, for an example event handlers are best example of this. One of the key benefits of an inner class is the "special-relationship" an inner class instance shares with an instance of the outer class. more...
- Inner Class
- Method-Local Inner Class
- Anonymous Inner Class
- Static Nested Class
Normally when you are programming a class should have code only for the things an object of that particular type needs to do, any other behavior should be part of another class better suited for that job. Sometimes though you design a class that has different behavior but also needs to be intimately tied to the class you're designing, for an example event handlers are best example of this. One of the key benefits of an inner class is the "special-relationship" an inner class instance shares with an instance of the outer class. more...



0 comments:
Post a Comment