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 SilverMembercannot 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.
Bats fly at night, 'cause they aren't we. And if we tried, we'd hit a tree -- Ogden Nash (or should've been).
Articles by Winston can be found here