Inheritance Problem when trying to implement Page Controller

  • Thread starter Thread starter Binod Nair
  • Start date Start date
B

Binod Nair

Hi All,

Can somebody tell me what I am doing wrong.

I have a Base Abstract Class

Public MustInherit Class BaseRequestHandler : Inherits System.Web.UI.Page

Protected Overridable Sub Page_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load

SomeMethod()

End Sub

Public MustOverride Sub SomeMethod()

End Class

I have a Web Page which Inherits this base class

Public Class ManageCatalog : Inherits BaseRequestHandler

Public Overrides Sub SomeMethod()

'Code Block

end sub

end class

When I try to run it , I get the error

Compiler Error Message: BC30610: Class 'ManageCatalog_aspx' must either be
declared 'MustInherit' or override the following inherited 'MustOverride'
member(s): Public Overridable MustOverride Sub SomeMethod().





Plss Help.. I am doing something really stupid..
 
Public MustInherit Class BaseRequestHandler : Inherits
System.Web.UI.Page
Protected Overridable Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
SomeMethod()
End Sub
Public MustOverride Sub SomeMethod()
End Class

I have a Web Page which Inherits this base class

Public Class ManageCatalog : Inherits BaseRequestHandler
Public Overrides Sub SomeMethod()
'Code Block
end sub
end class

When I try to run it , I get the error

Compiler Error Message: BC30610: Class 'ManageCatalog_aspx' must
either be declared 'MustInherit' or override the following inherited
'MustOverride' member(s): Public Overridable MustOverride Sub
SomeMethod().

It should be complaining that you have 2 methods of the same method
signature in the abstract class... both called "SomeMethod()". If it is
not complaining with the exact code you've shown, then it should be. It
may think you are overriding the SomeMethod() that is not marked as
"MustOverride"

If these are not the actual method signatures in each class, then show us
the real ones.
 
Michael Lang said:
It should be complaining that you have 2 methods of the same method
signature in the abstract class... both called "SomeMethod()". If it is
not complaining with the exact code you've shown, then it should be. It
may think you are overriding the SomeMethod() that is not marked as
"MustOverride"

Michael, I don't see two different "SomeMethod" methods. Could you point
them out, please?
 
Michael Lang said:
The following was in the original posted code...
====================================
SomeMethod()

End Sub

Public MustOverride Sub SomeMethod()

End Class
====================================

Yes, but that first SomeMethod() is a call to the second one, isn't it?
It's within the Page_Load method.

I don't really know VB.NET, but it certainly looks to me like there's
only one declaration of SomeMethod() there...
 
Yes, but that first SomeMethod() is a call to the second one, isn't it?
It's within the Page_Load method.

I don't really know VB.NET, but it certainly looks to me like there's
only one declaration of SomeMethod() there...

Oops. Since it wasn't indented I read it wrong. Also, I'm used to looking
at C# code. I depend on those curly braces and proper indentation to keep
me from getting lost.
 
Back
Top