It's not a secret anymore!
The moose likes Beginning Java and the fly likes class assignment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "class assignment" Watch "class assignment" New topic

class assignment

Nelson Nadal
Ranch Hand

Joined: Jun 06, 2002
Posts: 170
Pls help me to find in Sun Tutorial the explanation about like the case of class assignment such as the ff:
Employee e = new Manager();
given that class Manager is a subclass of Employee class.
Employee has class variable a=5,b=10 with method incr() and decr().
Manager has class variable a=10,b=20. and add'l method of maint().
... or what really happened here?

Correct me if I'm wrong:
I know that e object has a type of Employee...
object e can't access maint() of Manager
object e has a variable a=5 ang b=10
is this what happened? what else? what do you call these concept?
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059
[ August 09, 2002: Message edited by: Marilyn de Queiroz ]

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
...and you might want to take a look at The "How my Dog learned Polymorphism" Story of The JavaRanch Campfire Stories.
Good Luck.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: class assignment
It's not a secret anymore!