aspose file tools
The moose likes Beginning Java and the fly likes What happens when you want to extend to 2 different classes Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "What happens when you want to extend to 2 different classes" Watch "What happens when you want to extend to 2 different classes" New topic
Author

What happens when you want to extend to 2 different classes

Andrew Cleland
Greenhorn

Joined: Apr 13, 2005
Posts: 4
I am quite new to Java, and have been constructing a servlet, which works until I add some new functionality.

This new functionality just so happens to be a bunch of code I have copied from somewhere else. The copied code works fine in its own context. But the problem I have is that my servlet extends HttpServlet, and the copied code has a method from a different class, which was implemented in the original source as extends x.

The problem being that I can't extend 2 different classes, what is the way to tackle this problem?

Andrew
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You could create an instance of x and call its appropriate methods.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Andrew Cleland
Greenhorn

Joined: Apr 13, 2005
Posts: 4
Paul,

I was in the process of composing another message saying I did not understand what you meant, when I looked at the code again, and figured out what to do, from your suggestion. It now works.

Thank you.

Andrew
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What happens when you want to extend to 2 different classes
 
Similar Threads
Getting name of servlet
Proper Structure Question / Inheritance & Casting
How to share exception handling between different classes
Integrating Spring in an existing servlets project
Grading Program--Need help, please!!!