• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inheritance Problem

 
cor rupt
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 95
C++ Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the exception stack trace???
 
Winston Gutkowski
Bartender
Pie
Posts: 10508
64
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
LQ McDonald III
Greenhorn
Posts: 10
Eclipse IDE IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic