1 Replies - 684 Views - Last Post: 24 May 2011 - 06:39 AM Rate Topic: -----

#1 angels-luna  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 05-November 10

Based on Java, How to call a subclasses from the driver class?

Posted 24 May 2011 - 06:29 AM

My main class is called Driver and my subclasses are Individual, NGO, POrganisation and Government. These 4 subclasses are under the customer class and the only thing that differentiate them are rates and customertype. Different subclasses have different amount of rates ( NGO rate= 10%, Gov rate=15% etc) The 4 subclasses are inherits from customer class. So, can anyone help me by giving a sample on how to call the subclasses from the Driver class?
Is This A Good Question/Topic? 0
  • +

Replies To: Based on Java, How to call a subclasses from the driver class?

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8328
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Based on Java, How to call a subclasses from the driver class?

Posted 24 May 2011 - 06:39 AM

Really vague and philosophical question.
All OO languages are based on inheritage. What is exactly your question ?
Classes Car, Bus, Tramway, Train can inherit from Vehicule. So you can make
Vehicule x = new Bus(....);
Vehicule y = new TramWay(...);

You will have to tell us more of what you are trying to do
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1