-
Re: Doing Multiple Inheritance in java
HI Imran ,
I've a decent enough method to overcome the limitation .. and it is being
used currently in UI programming .. using the adapter classes(hope U know
them) .. it uses Inner classes
Suppose U have two classes X and Y which U want to inherit
class X
{}
class Y{}
when U inherit .. actually U want the existing functionality of both the
classes
so U can write a class as
class outer extends X
{
method(a)
{}
class inner extends Y
{}
}
Now follow the reasoning
1)An inner class can access the outer class's members
so the inner class here can access the members the outer class inherited
from X
2)... also as it(the inner class) itself extends Y it has access to the members
of Y ..
so ultimately U have access to both the classes X and Y from the inner class
..
but the reverse is not always true .. ie U may not be able to access the
members of the inner class thru the outer class
Think this will suffice ..
and every one else in case of any errors do suggest the corrections
Rahul
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks