Results 1 to 6 of 6
- 07-14-2010, 07:16 AM #1
Member
- Join Date
- Mar 2010
- Posts
- 6
- Rep Power
- 0
- 07-14-2010, 07:37 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,601
- Blog Entries
- 7
- Rep Power
- 17
The depth of the inheritance tree doesn't matter because when a class is loaded its parent class is already loaded and that one is the only class needed to set up a "virtual function table". i.e. a copy of that table is made and the overrriding method addresses are filled in.
kind regards,
Jos
- 07-14-2010, 08:18 AM #3
Member
- Join Date
- Mar 2010
- Posts
- 6
- Rep Power
- 0
Thanks Jos for Quick response
What I am wondering is as I keep on adding each new level of hierarchy, the overhead is constant or it is increasing per level of inheritance
- 07-14-2010, 08:25 AM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,601
- Blog Entries
- 7
- Rep Power
- 17
As I wrote in my previous reply: the depth of the inheritance tree doesn't matter. Just more classes need to be loaded if you want to load a deeply nested (inheritane wise) class. The loading per class doesn't slow down when the depth of the class increases.
kind regards,
Jos
- 07-14-2010, 09:42 AM #5
Member
- Join Date
- Mar 2010
- Posts
- 6
- Rep Power
- 0
tHANKS jOS
This is really helpful
- 07-14-2010, 09:51 AM #6
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
Instantiating instances of the classes will be affected though, depending on what the constructors of those classes do. As long as none of them do anything "exotic" it is negligible (unless you're instantiating millions of them), but just keep in mind that when you instatiate an object a constructor will be executed in every one of those classes in order to facilitate the instantiation.
Similar Threads
-
Getting log level in Appender class
By ashu_knw in forum New To JavaReplies: 0Last Post: 05-14-2010, 11:22 AM -
how to call higher level super class method?
By satheeshtech in forum Advanced JavaReplies: 2Last Post: 01-12-2010, 03:11 PM -
[SOLVED] Class-level vs Object-level method()
By mfaizan24 in forum New To JavaReplies: 7Last Post: 06-23-2009, 09:18 AM -
Help with Java Robot and Runtime Class
By Rmond1254 in forum New To JavaReplies: 1Last Post: 02-18-2009, 06:33 AM -
Example of RunTime class
By Java Tip in forum Java TipReplies: 0Last Post: 01-04-2008, 09:32 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks