Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / December 2005

Tip: Looking for answers? Try searching our database.

Overhead base class versus derived class method invocation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
question - 20 Dec 2005 14:15 GMT
I want to know incase there is any performance difference or overhead
in calling a base class method and a derived class method.

Basically I am talking about simple method that is not overridden nor
virtual. If I declare a method in the base class say M1() and another
in derived class M2(). Then I make a derived class object derived. I
then invoke these:

derved.M1()
derived.M2()

What difference would it be.

Also does the size of the class object increase with more method
members in the class. Incase I add methods to the base class would it
increase the size of the derived class also.

Thankx in advance to you all.
Nicholas Paldino [.NET/C# MVP] - 20 Dec 2005 14:29 GMT
   Basically, nothing.  There would be a lookup in the method table for the
object, and then it would be executed.

   Honestly, it's not even something to be concerned about.

   The size of the ^type^ will increase with each member in the class, as
well as any derived classes.  However, you ^REALLY^ shouldn't worry about
this.  Unless you had hundreds of members though.  However, at this point, I
wouldn't be worried about performance (it still wouldn't be an issue), but
because of design (one type with that many members is excessive, and poorly
designed).

   Hope this helps.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

>I want to know incase there is any performance difference or overhead
> in calling a base class method and a derived class method.
[quoted text clipped - 14 lines]
>
> Thankx in advance to you all.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.