Java - SuperClass / SubClass

Discussion in 'Software' started by sheepondrugs, Dec 24, 2008.

  1. sheepondrugs

    sheepondrugs Private First Class

    Hey guys,

    This problem is driving me utterly nuts.

    I am creating a bank account system (demo) in java..

    I Currently Have these classes ..

    -Customer
    -Account (super class)
    --Type1 (sub class of Account)
    --Type2 (sub class of Account)
    --Type3 (sub class of Account)


    is there a way to make Customer the Super Class, Account the sub class, and Type1,2,3 the sub-sub class?


    Thanks in advance :wave
    (and have a nice christmas)
     
  2. Kodo

    Kodo SNATCHSQUATCH

    Customer should NOT be a super class of account. They're relationships are not inheritance related.
    The account should be distinct from Customer in so much as the customer will OWN an account.

    I would make an account and then an account type enum and then a customer class.
    Have a property off the account that is the enum which describes the account type. You can base your class logic off the enum.
     
  3. sheepondrugs

    sheepondrugs Private First Class

    sorry im kinda of new to java could you explain this "enum" please? :)

    thanks for the reply!
     
  4. Kodo

    Kodo SNATCHSQUATCH


MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds