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 / Visual Studio.NET / IDE / April 2007

Tip: Looking for answers? Try searching our database.

How to get the 2005 IDE to auto-generate the template code for an Overrideable method?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jack - 29 Apr 2007 12:27 GMT
I want to override an overridable method in some base class from my
class. It works fine if I manually code the method (as one would
expect), but I want the IDE to auto-generate the template code for me
so I don't have to type all of it in. I'm sure this is possible.

Apparently you can do it from the class designer somehow by openning
the class designer, drilling up through the inheritence heirarchy,
choosing the method ( eg. OnPaint(..) ) and then right-clicking on it
and select Add->Override. But when I right-click I don't get the
'Override' option.

I know from the editor, you can start to type the keywords: 'Protected
Overrides' and then the IDE will kick-in with the avaliable selection.
Here you can scroll down the list and hit ENTER on the method you
want. This works fine-and-dandy, but is there another way?

Thanks,
Jack.
Bryan Phillips - 30 Apr 2007 05:47 GMT
If the base class is abstract, the IDE will automatically generate the
base class's abstract methods in the sub class as soon as you inherit
from the base class.  It works the same way as implementing interfaces.

Example:

   public abstract class BaseClass { // abstract is required to have
abstract members
       public virtual int SomeMethod() { // virtual is required if you
want the subclass to be able to                                 // override this too
           return 0;
       }

       public abstract int SomeOtherMethod(); // subclass must
implement this method

   }

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog:  http://bphillips76.spaces.live.com
Web Site:  http://www.composablesystems.net

> I want to override an overridable method in some base class from my
> class. It works fine if I manually code the method (as one would
[quoted text clipped - 14 lines]
> Thanks,
> Jack.

Rate this thread:







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.