aspose file tools*
The moose likes Beginning Java and the fly likes Inheritance Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Inheritance Problem" Watch "Inheritance Problem" New topic
Author

Inheritance Problem

cor rupt
Greenhorn

Joined: Aug 01, 2012
Posts: 1
Hi, I'm new here. I have a little problem with inheritance. Here are my codes that i made:







The program produces few errors. Please help me with it. Thanks!!!

-corrupt1234
Naishadh Parmar
Ranch Hand

Joined: Jun 02, 2011
Posts: 95

Can you post the exception stack trace???
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7823
    
  21

cor rupt wrote:Hi, I'm new here. I have a little problem with inheritance. Here are my codes that i made:

I suspect others will have dealt with the mechanics, so I'm going to concentrate on what inheritance is.

I have to admit to being intrigued with your idea of making a SilverMember a subclass - for about 30 seconds.

I understand what you're thinking about, but the fact is: It won't wash.
If a Gymnasium is a class that is trying to encapsulate a gym, then SilverMember cannot be a subclass, because it isn't a gym; it's a member of (or possibly a set of rules concerning) a gym.

Create a class called GymMember, and then you may have a case for creating a SilverMember subclass.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
LQ McDonald III
Greenhorn

Joined: Aug 01, 2012
Posts: 10

Winston has the start of it. Until you fix the super/sub class structure you currently have it doesn't even make sense to diagnose the problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inheritance Problem