Thread: parent/child
View Single Post
Join Date: May 2007
Posts: 4,346
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 498
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: parent/child

 
0
  #6
Oct 30th, 2007
"pc" is a ProcessCard object. newAccount() is just changing the account number - it is not creating a new object. To do that you need to set pc = new DebitCard(); That will create a DebitCard object, which inherits from the ProcessCard. Unless you need to call a method that is specific to the DebitCard class, you can still use the debit card object by it's ProcessCard base class interface.
Reply With Quote