This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How to use Ploymorphism Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to use Ploymorphism" Watch "How to use Ploymorphism" New topic
Author

How to use Ploymorphism

James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282

I guess this is a polymorphism question. In the Notebook class I am wanting to call the setFont method from the Page class. I can create a Page object but that object is only viable within the method I create it. Then in the Page class I am wanting to get the font of the text area that's created in the Notebook class.








Visit my blog! http://jameshambrick.com
Brad Dwan
Ranch Hand

Joined: Apr 22, 2010
Posts: 62
google gave me this:
LINK

what's wrong with page1 you declared at the top?


also I don't really think you need extend Page with Notebook. You Already have an object page1; you should be able to access all of Page -s methods with that.
so you could use:

I dunno, haven't tested it or anything, but the object is there and methods are public, so I can't see why it wouldn't work.


-Nev
"It's about choosing your battles, not fighting somebody else's war"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use Ploymorphism