Solved

Overriding a method, how to know signature?

Posted on 2007-11-21
5
200 Views
Last Modified: 2010-04-15
hi there,

i wonder if anyone can help, i am overriding a couple of methods from a class... but is there anyway to easily create the method without having to look at the object browser to know the signature..

intellisense doesn't seem to provide me with the signature of the method i am ovverriding so i don't know which parameters to include?

Any ideas?

Thanks
0
Comment
Question by:iangregson1
  • 3
  • 2
5 Comments
 
LVL 25

Accepted Solution

by:
imitchie earned 500 total points
ID: 20332322
intellisense: try using base.MethodName(  at this point, it should give you the signature?
I think in the code window, there should also be an option to "generate override methods" for base class
0
 
LVL 25

Expert Comment

by:imitchie
ID: 20332337
if you are inheriting from an abstract class, you can type a skeleton like so

public class MyTest : AbstractClass {}

then hover over the A in "AbstractClass".
choose: implement abstract class "AbstractClass"

if it's inheriting a concrete class, then you create the class first.  When you start  typing the method signature "   public override void M" below, code completion should give you the ones you can override starting with M

public class My2Test : MyTest {
   public override void M
}
0
 

Author Comment

by:iangregson1
ID: 20332387
Damb! yes thats what i thought, it wasn't working i think i need to reboot...

I wonder if i can ask 1 more thing... it is working but i just want to see if i am doing it the best way..

I have a class (not abstract but base) which another class inherits

There is some code in the base class in page_load that MUST be run no matter what

and then the derived class can implement/ovveride its own page_load

question is .... what is the program forgets to call base.Page_Load etc..

Is there some other way... maybe sealing a method on onload or something??

should i really be making virtual page_load rather than onLoad..

Any advice really appreciated

Thanks
0
 
LVL 25

Expert Comment

by:imitchie
ID: 20332405
you can
mark the page_load as final - so that this cannot be overridden
in page_load, do what you must do, then make a call to another function, say "on_page_load" which you make virtual

now descendant classes can interact with page load (override "on_page_load"), but still not escape the "must happen" code
0
 

Author Comment

by:iangregson1
ID: 20332503
its working now.. a reboot sorted it out.. and thanks for the comments on the page_load info.

Assigning points
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now