473,386 Members | 1,775 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,386 software developers and data experts.

Re: Access 'parent' variables

RichB wrote:
Thanks, i had thought along those lines, but didn't think that it was
very oo as B is not really a part of Object A.
If it isn't really a part of object A, then it shouldn't depend on it
either.

Provide a "validation context" type of object to it instead of a
"parent", so that it can validate itself against the context, not
necessarily the "parent". An interface containing just the needed
properties is a good way to go here.

What happens if you have a B without an A?

--
Lasse Vågsæther Karlsen
mailto:la***@vkarlsen.no
http://presentationmode.blogspot.com/
PGP KeyID: 0xBCDEA2E3
Jun 27 '08 #1
1 1594
Sorry, I had got my As and Bs mixed. B is a part of A, but B also is
dependent on A in it's validation. It was the reference to A in B which did
not seem appropriate to me. What you say below is actually very valid
though.

My structure is actually that B is a part of A and part of another object
(C). So something like this:

A--C--B1
|
B2

In actuality B1 is dependent on the date values in B2 which is the same
class. With this being the case is validation context object the way to go?
I am not however quite sure what is meant by a validation context object,
especially when you add your note about an interface, could you explain this
concept a little more.

My first thoughts are that the validation context is a wrapper (D) to B with
the validation data referenced within it i.e.:

A--C--D--B1
|
B2

But where does the Interface come in, is it just a 'template' for D,
something like:

interface iMinMaxDate
{

DateTime Max{get;set;}
DateTime Min{get;set;}
D objectD{get; set;}

ValidateDateTimes(DateTime min, DateTime max, DateTime dateToValidate)
}

I hope that this makes sense, or have I really confused matters?

Thanks, Richard
"Lasse Vågsæther Karlsen" <la***@vkarlsen.nowrote in message
news:uF**************@TK2MSFTNGP06.phx.gbl...
RichB wrote:
>Thanks, i had thought along those lines, but didn't think that it was
very oo as B is not really a part of Object A.

If it isn't really a part of object A, then it shouldn't depend on it
either.

Provide a "validation context" type of object to it instead of a "parent",
so that it can validate itself against the context, not necessarily the
"parent". An interface containing just the needed properties is a good way
to go here.

What happens if you have a B without an A?

--
Lasse Vågsæther Karlsen
mailto:la***@vkarlsen.no
http://presentationmode.blogspot.com/
PGP KeyID: 0xBCDEA2E3
Jun 27 '08 #2

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

Similar topics

1
by: Manuel Canas | last post by:
Hi there, I'm having a hard time figuring out why is this happening. The problem is a couple of variables are not getting properly initialized when I load a FormX from it's parent form. I...
10
by: Goran Djuranovic | last post by:
Hi all, Does anyone know how to declare a variable in a class to be accessible ONLY from a classes instantiated within that class? For example: ************* CODE ***************** Public...
2
by: Rob Long | last post by:
Hi there Is there any way to access private variables directly from within a priviliged function? I have a situation where the priviliged function's execution context contains variables of the...
3
by: rick | last post by:
I have a situation where I want to write an extensible class that is capable of saving / restoring properties of classes derived from it. A simplified example is explained as follows;- class A...
9
by: Bart Friederichs | last post by:
Hi, I have an index.html with a frameset with 2 php files. The top frame are buttons, that refresh the lower frame or put different content in it. Some of these pages have javascript-tabs and I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.