473,473 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Inheriting local variables from a common source?

I have 3 pages, each with 2 tables (tblNew and tblConfirm), because these 2
tables are affected by the same code, I thought if I used an inherited class
defining these variables along with the code, it would work.

It does, to a point, but everytime I hit "Save" I will see errors pile up
thanks to conflicting variable names.

On the code-behind for the pages, VS will fill in the variable names even
though I have already declared them in the inheritted class.

Doesn't VS traverse the inherited list or are these ignored and only used at
compilation?
Nov 17 '05 #1
2 1269
Hi All

I think a good case study will be a big help in learning OOAD. Does anyone
have a COMPLETE Case Study? I have been searching it for years and got
nothing till today.

A complete case study should have:
1. A clear Problem Description or Requirement.
2. Object-Oriented Analysis in UML diagrams.

Regards
Amit Chaudhary
Nov 17 '05 #2
"Wayne J" <no**@anyisp.com> wrote in message
news:#Y**************@tk2msftngp13.phx.gbl...
I have 3 pages, each with 2 tables (tblNew and tblConfirm), because these 2 tables are affected by the same code, I thought if I used an inherited class defining these variables along with the code, it would work.

It does, to a point, but everytime I hit "Save" I will see errors pile up
thanks to conflicting variable names.

On the code-behind for the pages, VS will fill in the variable names even
though I have already declared them in the inheritted class.

Doesn't VS traverse the inherited list or are these ignored and only used at compilation?


VS doesn't traverse anything. Its model is much simpler: if you put the
control on the .aspx page, then a protected reference to that control will
be placed on the .aspx.cs page. Period.

Depending on the complexity of your code, you might want to define a class
which encapsulates all the common processing done on the tables, and which
perhaps contains a public property which you can set to be a reference to
the table. Then that class will have all the local variables.

Besides, even if the inheritance worked, you wouldn't really want to have
common base pages for something like this. Since there's only single
inheritance, you want to inherit from something important - you don't want
to have a base class called "PagesWithThisSortOfTableOnThem"!
--
John
Nov 17 '05 #3

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

Similar topics

1
by: richardlane | last post by:
Hi, basic question here - I'm struggling with the transfer from asp to asp.net a bit, especially in seeing the 'bigger picture' of how things are best structured. I have a website made up...
5
by: masood.iqbal | last post by:
My simplistic mind tells me that having local variables within looping constructs is a bad idea. The reason is that these variables are created during the beginning of an iteration and deleted at...
1
by: richardlane | last post by:
Hi, basic question here - I'm struggling with the transfer from asp to asp.net a bit, especially in seeing the 'bigger picture' of how things are best structured. I have a website made up...
55
by: Zytan | last post by:
I see that static is more restricted in C# than in C++. It appears usable only on classes and methods, and data members, but cannot be created within a method itself. Surely this is possible in...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
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...
1
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
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.