473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Inheritance Problem

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..



Nov 17 '05 #1
3 3544
John thanks a lot

The problem was here

I HAD IT AS
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
Inherits="TestVBWebApp.BaseRequestHandler "%>

AND NOT LIKE WHAT John said
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
Inherits="TestVBWebApp.WebForm1"%>

It doesnt make sense to me why it needs to be like this ..Shouldnt it be
like the way i had declared..

John can u share ur thoughts about this.Also can u give an example when the
inherits value in "<%@ Page Language.." is going to be different.

--binod

"Binod Nair" <na*******@hotmail.com> wrote in message
news:eJ**************@TK2MSFTNGP09.phx.gbl...
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..



Nov 17 '05 #2
"Binod Nair" <na*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
John thanks a lot

The problem was here

I HAD IT AS
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="TestVBWebApp.BaseRequestHandler "%>

AND NOT LIKE WHAT John said
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="TestVBWebApp.WebForm1"%>

It doesnt make sense to me why it needs to be like this ..Shouldnt it be
like the way i had declared..

John can u share ur thoughts about this.Also can u give an example when the inherits value in "<%@ Page Language.." is going to be different.


Here's the way it "normally" works when a CodeBehind page is used. You've
got page WebForm1.aspx. This is parsed and compiled into a class with a
generated name, like, ASPX_WebForm1. This class inherits from the class
mentioned in the Inherits attribute in the Page directive.

WebForm1.aspx.vb contains your codebehind class. It would declare a class
called WebForm1 in the TestVBWebApp namespace. The WebForm1 class inherits
from System.Web.UI.Page. So you have the following:

ASPX_WebForm1 ==> TestVBWebApp.WebForm1 ==> System.Web.UI.Page

An example of when this would be different is in the case where codebehind
is not used. In that case, the Inherits attribute says
Inherits="System.Web.UI.Page". That is:

ASPX_WebForm1 ==> System.Web.UI.Page

As an example of when the Inherits in the codebehind would be different is a
situation like yours:

ASPX_WebForm1 ==> TestVBWebApp.WebForm1 ==> TestVBWebApp.BaseRequestHandler
==> System.Web.UI.Page

Note that in this case, you still need the Inherits="TestVBWebApp.WebForm1",
since that's the class which ASPX_WebForm1 inherits directly from.
--
John Saunders
Internet Engineer
jo***********@surfcontrol.com
Nov 17 '05 #3
John..

Thanks a lot.I guess I need to keep reading rather than doing coding.

"John Saunders" <jo***********@surfcontrol.com> wrote in message
news:e4**************@TK2MSFTNGP12.phx.gbl...
"Binod Nair" <na*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
John thanks a lot

The problem was here

I HAD IT AS
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
Inherits="TestVBWebApp.BaseRequestHandler "%>

AND NOT LIKE WHAT John said
<%@ Page Language="vb" AutoEventWireup="false"

Codebehind="WebForm1.aspx.vb"
Inherits="TestVBWebApp.WebForm1"%>

It doesnt make sense to me why it needs to be like this ..Shouldnt it be
like the way i had declared..

John can u share ur thoughts about this.Also can u give an example when

the
inherits value in "<%@ Page Language.." is going to be different.


Here's the way it "normally" works when a CodeBehind page is used. You've
got page WebForm1.aspx. This is parsed and compiled into a class with a
generated name, like, ASPX_WebForm1. This class inherits from the class
mentioned in the Inherits attribute in the Page directive.

WebForm1.aspx.vb contains your codebehind class. It would declare a class
called WebForm1 in the TestVBWebApp namespace. The WebForm1 class inherits
from System.Web.UI.Page. So you have the following:

ASPX_WebForm1 ==> TestVBWebApp.WebForm1 ==> System.Web.UI.Page

An example of when this would be different is in the case where codebehind
is not used. In that case, the Inherits attribute says
Inherits="System.Web.UI.Page". That is:

ASPX_WebForm1 ==> System.Web.UI.Page

As an example of when the Inherits in the codebehind would be different is

a situation like yours:

ASPX_WebForm1 ==> TestVBWebApp.WebForm1 ==> TestVBWebApp.BaseRequestHandler ==> System.Web.UI.Page

Note that in this case, you still need the Inherits="TestVBWebApp.WebForm1", since that's the class which ASPX_WebForm1 inherits directly from.
--
John Saunders
Internet Engineer
jo***********@surfcontrol.com

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mark A. Gibbs | last post by:
Good day, i'm having a bit of trouble with a base class i'm working on. this is what it boils down to: template <typename T> class foo { protected: foo() { T* p = static_cast<T*>(this); }
9
by: vidalsasoon | last post by:
Ok, this is the structure of my classes. " class Global " | " ------------------------------------------- " | ...
1
by: Michael | last post by:
Hello, I'm trying to implement sample I found on page templates, so I do not have to maintain "<html><head>..." on all my documents. But don't let that confuse you, this is an inheritance...
0
by: Mariano | last post by:
Hi, I have posted a bug of the forms designer that overwrites always the Icon, thus preventing Icon inheritance when you derive from a form. I am trying to overcome this by adding an ImageList in...
9
by: surendran.d | last post by:
hi, can diamond inhertance problem be solved using virtual functions,, or can only be done with scope resolution operators.. is there any other way to solve this problem... Thanks, suri
2
by: goldie11 | last post by:
Hi, I have two classes - A,B that inherit from an abstract class C. The problem is that I need a global field which has always the same value for the two classes. If I put the field in class C -...
4
by: amidzic.branko | last post by:
I'm trying to solve a problem using inheritance and polymorphism in python 2.4.2 I think it's easier to explain the problem using simple example: class shortList:
8
by: Hans-Dieter Dreier | last post by:
Hi NG, I have an inheritance like this: class a_interface { virtual bool x() = 0; }; class a_version_1 : public a_interface
3
by: Leo Seccia | last post by:
Hello everyone, I have a c# project with a sql server database. I have a number of lookup tables in my database which I successfully managed to import into my LINQ dataclasses. eg. Table:...
1
by: thedoxp | last post by:
I'm new at c# and I have little problem when use List and Inheritance I have Inheritance& Like this public abstract class Light {} public class OpenLight:Light {}
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.