Over Riding New?

T

TisMe

Hi All,

I am (As you may have seen from my last two posts!) converting from VB
to C#

At the moment, I am stuck with over riding the New method of my class.

I am trying to have a new which allows the user to pass the context of
the current HTTPApp (This class will be used by a web app)

Heres what I have so far, this doesnt work...Visual studio underlines
the open bracket with message:
"Invalid token '(' in class, struct, member or interface declaration"

public new void(HttpApplication currentHTTPApp) {
_HttpApplication = currentHTTPApp;
}

Any help here will be appreciated!

Cheers!
 
J

Jon Skeet [C# MVP]

TisMe said:
I am (As you may have seen from my last two posts!) converting from VB
to C#

At the moment, I am stuck with over riding the New method of my class.

There's no such method as "new" - there are constructors. You don't
override a constructor, you just provide constructors for your class.
For instance:

public class Test
{
// This is a constructor
public Test(string x)
{
}
}

There's more about constructors at
http://pobox.com/~skeet/csharp/constructors.html
 
T

TisMe

There's no such method as "new" - there are constructors. You don't
override a constructor, you just provide constructors for your class.
For instance:

public class Test
{
// This is a constructor
public Test(string x)
{
}

}

There's more about constructors athttp://pobox.com/~skeet/csharp/constructors.html

Jon, Thank you - I will have a read.

Simon.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top