why can't you declare new as overridable?

S

steve kain

Hi.

I'm just wondering how come the compiler complains when
you declare a new sub as overridable but it then lets you
define multiple new subs with different interfaces,
essentially overriding each other.

For example, this doesn't work:

public overridable sub new()
end sub

public overrides sub new(byval x as string)
end sub

But this does:

public sub new()
end sub

public sub new(byval x as string)
end sub

Obviously, I can still do what I need to do, but I'd like
to understand why this is so.

Thanks,

skain
 
H

Herfried K. Wagner

Hello,

steve kain said:
I'm just wondering how come the compiler complains when
you declare a new sub as overridable but it then lets you
define multiple new subs with different interfaces,
essentially overriding each other.

This doesn't make sense because constructors are not inherited.

Regards,
Herfried K. Wagner
 

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