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

Generalisation?  RSS feed

 
Rupinder Bains
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does generalisation mean within 00 programming?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you find a number of classes doing the same thing, you might "generalize" that common behavior into a common superclass. If you find one class doing different things you might "specialize" the unique behavior into new subclasses. These are neat ways to think about how you find the need for inheritance.

Those conditions I mentioned are not complete and sufficient, but hints as to when to think about inheritance. Or composition
 
Rupinder Bains
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you... You have been really helpful... My revision is going well... hopefully I will pass the exam on friday... these past paper questions are hectic... but I understand what you mean by specialisation and generalisation. Thank you Stan
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!