Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in Java only
Search
Advanced Search
Forums
BYTES
Product Launch
Updates
Developer Toolkit
Today's Posts
Member List
Calendar
Home
Forum
Topic
Java
Generic references for sub class object
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
Larsen
New Member
Join Date:
May 2011
Posts:
2
#1
Generic references for sub class object
May 20 '11, 02:28 AM
Hi all,
What is the advantage of having generic reference to sub class objects?
Animal h = new Horse();
Dheeraj Joshi
Recognized Expert
Top Contributor
Join Date:
Jul 2009
Posts:
1129
#2
May 21 '11, 03:35 AM
Are you talking about programing to an interface rather than implementations ?
I am confused. Can you elaborate a little?
Check this
link
Regards
Dheeraj Joshi
Comment
Post
Cancel
Larsen
New Member
Join Date:
May 2011
Posts:
2
#3
May 21 '11, 08:38 AM
Hi Dheeraj,
Consider we have a super class A and a sub class B. What is the advantage of having super class reference type for a sub class object? Like,
A a = new B();
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment