-
October 7th, 2004, 08:51 PM
#1
Java Question
If the java.awt.Graphics class is abstract then how can methods such as this.getGraphics() return a Graphics object ?
-
October 7th, 2004, 10:10 PM
#2
Polymorphism allows it to return a Graphics object because its actually calling a subclass with a method that actually returns a value.. I don't know the specifics of it but the Graphics class is a super class and then it has a blank outline out what methods each subclass has to have...
See this link for more explanation: http://java.sun.com/docs/books/tutor.../abstract.html
-
October 7th, 2004, 11:40 PM
#3
most likely because whatever class 'this' is an instance of inherits from java.awt.Graphics.
"When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
"There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
"Mischief my ass, you are an unethical moron." - chsh
Blog of X
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|