Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Usefulness of Inner Classes  RSS feed

 
Mohammed Azeem
Ranch Hand
Posts: 56
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Evening Everyone,

This post is connected to my last post "How can two different objects receive notification of the same event?"

A correct solution to that specific problem was provided by Omar Rashwan - thank you Omar.

However, I realised that it was not the question I should have been asking in the first place - comments from Campbell Ritchie provided an impetus.

So I re-analysed the problem, with simple diagrams, and found that the use of the INNER CLASS provided a much more elegant solution.

That re-analysis has resulted in a short article Usefulness of Inner Classes click on link that simply encapsulates the problem and provides the solution (without the nitty gritty of my project). I hope that people faced with brain-warp, as I was, might find it useful.

The implementation of the inner class solution appears in the source code below:








 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a question?
 
Mohammed Azeem
Ranch Hand
Posts: 56
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh crikey no!

Just thought I'd share something that realised today.
 
Mohammed Azeem
Ranch Hand
Posts: 56
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok so the forums are just for posting questions/problems.

Got it.
 
Paul Clapham
Sheriff
Posts: 22504
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohammed Azeem wrote:Ok so the forums are just for posting questions/problems.


Well, not really. It's just that we're surprised when people post solutions instead of questions, because people almost never do that. But there's certainly nothing wrong with it, and maybe someday somebody searching the forum will find your post and find it useful.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohammed Azeem wrote:Ok so the forums are just for posting questions/problems.

Like Paul said, not really. But I've seen so may instances of people posting code and forgetting to ask the question that I wanted to be sure

That said, AWT has been obsoleted by Swing around 15 years ago, so there aren't going to be a lot of people to adopt your code. The same principle does apply in Swing though.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!