when you create above, person[1] and person[2] will not be Attributes
and methods of the class Employee and the class Manager.
you should create as following:
Person[] person = {new Person(), new Employee(), new Manager() };
Employee e=(Employee) peron[1];
Manager m=(Manager) person[2];

On May 29, 1:19 am, Lakshmi Chidambaram <[email protected]> wrote:
> Since the Person class is the super class of Manager and Employee, you can 
> create it in the following way.
> Person[] person = {new Person(), new Employee(), new Manager() };
>  
> hope this is helpful.
>
> --- On Thu, 28/5/09, [email protected] <[email protected]> wrote:
>
> From: [email protected] <[email protected]>
> Subject: [java programming] help to me about Inheritance in java
> To: "Free Java Programming Online Training Course By Sang Shin" 
> <[email protected]>
> Date: Thursday, 28 May, 2009, 10:21 PM
>
> I have three class as following
>
> - person class
> - employee class
> - manager class
>
> employee class and manager class extend the class person
> I want to create a person array with 3 elements
> element 1 is person
> element 2 is employee
> element 3 is manager
>
> how to create 3 elements ?
>
>       Cricket on your mind? Visit the ultimate cricket website. 
> Enterhttp://beta.cricket.yahoo.com

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to