473,625 Members | 3,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Namespaces and Visibility


Do sub Namespaces have visibility to parent class. ie.
I am trying to develop an application that is made up of
modules and the main module contains a variables class
that contains all the variables needed for the
application.

eg.

MainModule Namespace
Contains MainMod Class
Variables Class

MainModule.SubM odule Namespace
Contains SubMod Class

MainMod class populates the variables class and is the
main entry point of the application and it also calls
methods in the SubMod Class. Can SubMod Class get access
to the Variables Class and its members.

If not how should this be designed/developed.

Thanks Kel.

Jul 21 '05 #1
3 1515
Sure, but you either have to import them or qualify them with the full name.

Namespaces have no "visibility " issues - they're always visible and public.
What's inside them is what counts.
--
_______________ _____
Klaus H. Probst, MVP
http://www.vbbox.com/

"kele" <ke********@yah oo.com.au> wrote in message
news:36******** *************** *****@phx.gbl.. .

Do sub Namespaces have visibility to parent class. ie.
I am trying to develop an application that is made up of
modules and the main module contains a variables class
that contains all the variables needed for the
application.

eg.

MainModule Namespace
Contains MainMod Class
Variables Class

MainModule.SubM odule Namespace
Contains SubMod Class

MainMod class populates the variables class and is the
main entry point of the application and it also calls
methods in the SubMod Class. Can SubMod Class get access
to the Variables Class and its members.

If not how should this be designed/developed.

Thanks Kel.

Jul 21 '05 #2

It would still not work, because you can not have
circular dependencies so if you add the reference to the
SubModule Namespace in the MainModule you can call
methods etc in the SubModule classes. But you can not
access the Variables class from the SubModule classes.

The only way I can think of getting around this is to
have the Variables Class in a module on its own (which
doesn't make as much sence).

I just wanted to know what Microsofts best practice is
for this type of design.
Jul 21 '05 #3
Kele,
As Klaus suggested NAMESPACES do not reference each other, hence there is no
chance of a circular dependencies!

..NET is able to handle correctly if you have two types (type as in classes,
structures, interfaces) that reference each other within the same assembly.

The problem comes in when you have two Assemblies reference each other,
which can lead to circular dependencies, as the first needs to be compiled
before the second, however the second needs to be compiled before the first.

If I have a need for two assemblies referencing each other, I normally
implement the Separated Interface.

http://www.martinfowler.com/eaaCatal...Interface.html

In the SubModule, define an Interface that the MainModule implements, that
the SubModule uses. Alternatively define the Interface in a third assembly.
The MainModule is then free to reference the SubModule, while the SubModule
is not explicitly dependent on the MainModule.

Hope this helps
Jay

"kele" <ke********@yah oo.com.au> wrote in message
news:45******** *************** *****@phx.gbl.. .

It would still not work, because you can not have
circular dependencies so if you add the reference to the
SubModule Namespace in the MainModule you can call
methods etc in the SubModule classes. But you can not
access the Variables class from the SubModule classes.

The only way I can think of getting around this is to
have the Variables Class in a module on its own (which
doesn't make as much sence).

I just wanted to know what Microsofts best practice is
for this type of design.

Jul 21 '05 #4

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

Similar topics

4
2809
by: Jonathan | last post by:
Hi, I've read through quite a number of postings on here so far and have seen what look like very simply, reasonable answers to this question, however I am still completely unable to do what I want to do. I just want to know how I should toggle the visibility of divs in Netscape (I'm using 7). For example, say I have the following HTML code:
3
29673
by: Jukka K. Korpela | last post by:
I have noticed that the meaning of visibility: collapse has been discussed on different forums, but with no consensus on what it really means. Besides, implementations differ. The specification says: "The 'visibility' property takes the value 'collapse' for row, row group, column, and column group elements. This value causes the entire row or column to be removed from the display, and the space normally taken up by the row or column to...
12
3900
by: lawrence | last post by:
The following function correctly makes everything invisible but then fails to turn the one chosen DIV back to visible. I imagine I'm getting the syntax of the variable wrong? I've tried this with both single quotes and no single quotes, but it doesn't work either way. What am I doing wrong? <SCRIPT type='text/javascript'> function makeVisible(nameOfDiv) { document.getElementById('weblogs').style.visibility='hidden';
4
5463
by: lawrence | last post by:
Can anyone tell me why this code works in Netscape 7.1 but not in IE??? <SCRIPT type='text/javascript'> function makeVisible(nameOfDiv) { document.getElementById(nameOfDiv).style.visibility='visible'; document.getElementById(nameOfDiv).style.height='auto'; if (nameOfDiv != 'weblogs')
8
3367
by: TTroy | last post by:
I have a few questions about "scope" and "visibility," which seem like two different things. To me "visibility" of the name of a function or object is the actual code that can use it in an actual program. To me "scope" of the name of a function or object are the general rules for the areas of a program that can through a declaration, have "visibility."
3
311
by: kele | last post by:
Do sub Namespaces have visibility to parent class. ie. I am trying to develop an application that is made up of modules and the main module contains a variables class that contains all the variables needed for the application. eg. MainModule Namespace Contains MainMod Class
4
396
by: mabster | last post by:
Hi folks, I'm just starting to come to grips with web services in general, and I'm in the process of making some test projects based on example code from MSDN etc. When I create a new ASP.NET web service, VS.NET makes a new .cs file for me that includes the web service class itself, inside a new namespace. In an example today (to manage a table of Levies) I renamed the Web
11
2617
by: -D- | last post by:
How can I turn the visibility of the xml control on or off? <%@ Control Language="c#" AutoEventWireup="false" Codebehind="TopNavBar.ascx.cs" Inherits="compass.user_controls.TopNavBar" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%> <table cellSpacing="0" cellPadding="0" border="0"> <colgroup span="1" align="left" width="50%"> </colgroup> <colgroup span="1" align="right" width="50%"> </colgroup>
3
5218
by: 2b|!2b==? | last post by:
I have a C++ library partitioned by namespaces. I want to export some of the functions in one of the namespace - how do I do it. Assuming I have the macro MYAPI_EXPORTS #defined to be a declspec import or export (as appropriate ... This is what the lib looks like: MyNamespace {
0
8253
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8189
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8497
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7182
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6116
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4089
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4192
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
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 we have to send another system

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.