473,513 Members | 2,401 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

inheritance in C#

I have a web page (compiled with .net 2.0 /Visual studio 2005)
http://people-places-work.info/addPerson.aspx
derived from System.Web.UI.Page, but I would like to insert an intermediate
class called addPersonBase from this local project.
This worked for me in VB, but C# wants something more.
---------addPerson.aspx.cs
public partial class addPerson :
//System.Web.UI.Page
addPersonBase
{ ....
}
----------end
---------addPersonBase.cs
public class addPersonBase :
System.Web.UI.Page
{
public addPersonBase ()
{
.....
}
----------end
Unfortunately when I do that I get an error
Error 1 The type or namespace name 'addPersonBase' could not be found (are
you missing a using directive or an assembly reference?)
Any ideas on how to fix that?
Aug 27 '08 #1
2 812

VB.NET had you on "training wheels" for namespaces (as the most likely
reason).

In VB.NET, right click a project and find the default namespace.
Whatever that is (its probably something like "MyApplication", the full name
of your class is
MyApplication.addPerson

in C#, you need to use the "using" statement, or fully qualify the class
name.

You also probably put "addPersonBase" in a different folder than your
addPerson class.

MyApplication
\Folder1\addPersonBase
\Folder2\addPerson

At the top of addPerson.cs, you'll need to put something like

using MyApplication.Folder1;

OR

public partial class addPerson : MyApplication.Folder1.addPersonBase
{}

...........................

This was one of my biggest issues with VB.NET back in the day. I hated
everything defaulted to the default namespace, and when you added a new
class, you had to manually type in

Namespace Graphics

End Namespace

....................

Ah...a very old post:
http://groups.google.com/group/micro...b8?hl=en%3Fd1a
Look for "MyCompany"


"support" <su***********@people-places-work.infowrote in message
news:uq**************@TK2MSFTNGP05.phx.gbl...
>I have a web page (compiled with .net 2.0 /Visual studio 2005)
http://people-places-work.info/addPerson.aspx
derived from System.Web.UI.Page, but I would like to insert an
intermediate class called addPersonBase from this local project.
This worked for me in VB, but C# wants something more.
---------addPerson.aspx.cs
public partial class addPerson :
//System.Web.UI.Page
addPersonBase
{ ....
}
----------end
---------addPersonBase.cs
public class addPersonBase :
System.Web.UI.Page
{
public addPersonBase ()
{
....
}
----------end
Unfortunately when I do that I get an error
Error 1 The type or namespace name 'addPersonBase' could not be found (are
you missing a using directive or an assembly reference?)
Any ideas on how to fix that?

Aug 27 '08 #2
Thanks that worked.
I ended up putting that code addPersonBase.cs in the folder App_Code and
addPersonBase was picked up by
addPerson.aspx.cs in the . folder

"sloan" <sl***@ipass.netwrote in message
news:uL**************@TK2MSFTNGP03.phx.gbl...
>
VB.NET had you on "training wheels" for namespaces (as the most likely
reason).

In VB.NET, right click a project and find the default namespace.
Whatever that is (its probably something like "MyApplication", the full
name of your class is
MyApplication.addPerson

in C#, you need to use the "using" statement, or fully qualify the class
name.

You also probably put "addPersonBase" in a different folder than your
addPerson class.

MyApplication
\Folder1\addPersonBase
\Folder2\addPerson

At the top of addPerson.cs, you'll need to put something like

using MyApplication.Folder1;

OR

public partial class addPerson : MyApplication.Folder1.addPersonBase
{}

..........................

This was one of my biggest issues with VB.NET back in the day. I hated
everything defaulted to the default namespace, and when you added a new
class, you had to manually type in

Namespace Graphics

End Namespace

...................

Ah...a very old post:
http://groups.google.com/group/micro...b8?hl=en%3Fd1a
Look for "MyCompany"


"support" <su***********@people-places-work.infowrote in message
news:uq**************@TK2MSFTNGP05.phx.gbl...
>>I have a web page (compiled with .net 2.0 /Visual studio 2005)
http://people-places-work.info/addPerson.aspx
derived from System.Web.UI.Page, but I would like to insert an
intermediate class called addPersonBase from this local project.
This worked for me in VB, but C# wants something more.
---------addPerson.aspx.cs
public partial class addPerson :
//System.Web.UI.Page
addPersonBase
{ ....
}
----------end
---------addPersonBase.cs
public class addPersonBase :
System.Web.UI.Page
{
public addPersonBase ()
{
....
}
----------end
Unfortunately when I do that I get an error
Error 1 The type or namespace name 'addPersonBase' could not be found
(are you missing a using directive or an assembly reference?)
Any ideas on how to fix that?


Aug 28 '08 #3

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

Similar topics

2
4361
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
2
4321
by: Graham Banks | last post by:
Does using multiple inheritance introduce any more performance overhead than single inheritance?
4
2881
by: JKop | last post by:
I'm starting to think that whenever you derive one class from another, that you should use virtual inheritance *all* the time, unless you have an explicit reason not to. I'm even thinking that...
5
2166
by: Morgan Cheng | last post by:
It seems no pattern defined by GoF takes advantage of multiple inheritance. I am wondering if there is a situation where multiple inheritance is a necessary solution. When coding in C++, should...
10
2633
by: davidrubin | last post by:
Structural inheritance (inheriting implementation) is equivalent to composition in that a particular method must either call 'Base::foo' or invoke 'base.foo'. Apparantly, The Literature tells us to...
14
12879
by: Steve Jorgensen | last post by:
Recently, I tried and did a poor job explaining an idea I've had for handling a particular case of implementation inheritance that would be easy and obvious in a fully OOP language, but is not at...
22
23319
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
45
6310
by: Ben Blank | last post by:
I'm writing a family of classes which all inherit most of their methods and code (including constructors) from a single base class. When attempting to instance one of the derived classes using...
60
4867
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the...
6
3798
by: Bart Simpson | last post by:
I remember reading on parashift recently, that "Composition is for code reuse, inheritance is for flexibility" see (http://www.parashift.com/c++-faq-lite/smalltalk.html#faq-30.4) This confused...
0
7264
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
7106
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7534
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...
0
5689
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5094
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3236
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1601
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.