• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Inheritance Problem

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 95
Python C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post the exception stack trace???
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 10
IntelliJ IDE Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic