Dear Sophia, Happy 7th Birthday How you have grown!!
AdultBirthday has been defined.
It will look much like
but with a
Here is a program fragment (part a
AdultBirthday ab = new AdultBirthday( "Walter", 47 ); ab.greeting();
It will write out:
Dear Walter, Happy 47th Birthday You haven't changed at all!
Now inspect the following code:
Card crd = new YouthBirthday( "Sophia", 7 ); crd.greeting(); crd = new AdultBirthday( "Walter", 47 ); crd.greeting(); crd = new Birthday( "Zoe", 30 ); crd.greeting();
Is this code correct? Can
crd be used for
each of the three objects?