• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Would �Colour�make a good abstract data type?

 
Ellen Zhao
Ranch Hand
Posts: 581
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would �Colour� make a good abstract data type? Why or why not? Thank you very much!
 
Dave Landers
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean as in java.awt.Color?
 
Ellen Zhao
Ranch Hand
Posts: 581
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. This question is an exercise of "The ABCs of objects", not neccessarily related to Java language, although the author does describe OOP in Java. Maybe I better put it in that "OO modeling, UML..."board
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Colour would make a lousy abstract type because it isn't spelled right (American = right).
Do you think Color would make a good abstract data type? Why or why not?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What operations would a datatype "Colo(u)r" have?
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
get/set wavelength ?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think that get/set are good operations for a datatype (well, get might work...).
A better operation might be something like "mix". Are there more?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic