By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,949 Members | 1,554 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,949 IT Pros & Developers. It's quick & easy.

Inheriting local variables from a common source?

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.