Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 19th, 2003, 01:35 PM
Authorized User
Join Date: Sep 2003
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default Inheritance and Name hiding

It seems like no body seems to be interested in answering my questions.. nonetheless I shall give it one more try.....

With regards to name hiding.. I have found that it is possible to hide an existing member in the base, simply by redeclaring it in the derived class preceeded by the keyweord 'new'.

I think I understand what it does, but on the other hand I don't see the difference between this and overriding a function.

Instead hiding the member wouldn't redefining it acheive the same thing!?

Some body please answermy question!!

Reply With Quote
  #2 (permalink)  
Old December 21st, 2003, 11:03 AM
Authorized User
Join Date: Sep 2003
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts

Replying to my own question.... for the sake of others who might not know....

The difference is that hiding an exsting member done at compile time... whereas overriding occurs at run time... which is why run-time polymorphism may not occur with simply hiding a base member.........

some body correct me if my understanding is wrong...........
Reply With Quote
  #3 (permalink)  
Old December 25th, 2003, 05:14 AM
Friend of Wrox
Join Date: Jun 2003
Location: , , .
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma

You will always find it difficult if you would try to differentiate between the two and yes simply redefining the method with a different name would serve the same purpose.
There are situations where you have to hide the base class definition of a method, otherwise you would always want to use overiding.

Ankur Verma
.Net and C++ Specialist
Wiley Tech Support
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible via Inheritance!!! mike_remember ASP.NET 2.0 Professional 0 November 26th, 2007 10:25 AM
Inheritance michaelcode ASP.NET 2.0 Basics 5 September 26th, 2006 01:40 PM
Inheritance abhi_bth ASP.NET 1.0 and 1.1 Basics 0 September 23rd, 2006 10:03 AM
Need help with inheritance filip BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 1 August 25th, 2006 09:38 PM

All times are GMT -4. The time now is 01:07 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.