473,407 Members | 2,315 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,407 software developers and data experts.

How to avoid NameSpace repetetion, in inheritance in different files.

Hi,

The problem to which I am looking for the solution is as under.

I have a abstract class and there are multiple classes inherting it to
implement some method(s).

All the class files, are in different physical files. The common using
directives are required to be written in each and every class file again and
again.

Is their a way, to include all the NameSpaces in the Parent Class ( in this
case the abstract class) and they become available to all the child classes
without me getting to write them all again and again. ofcourse, copy -
pasting is simple, but still is their some coding technique or in-built
feature which achives this.

Regards,
Sugandh
Mar 2 '07 #1
1 1381
On Mar 2, 7:34 am, "Sugandh Jain" <sugandh.j...@nirvana-sol.com>
wrote:
Hi,

The problem to which I am looking for the solution is as under.

I have a abstract class and there are multiple classes inherting it to
implement some method(s).

All the class files, are in different physical files. The common using
directives are required to be written in each and every class file again and
again.

Is their a way, to include all the NameSpaces in the Parent Class ( in this
case the abstract class) and they become available to all the child classes
without me getting to write them all again and again. ofcourse, copy -
pasting is simple, but still is their some coding technique or in-built
feature which achives this.

Regards,
Sugandh
I dont think you have to have all the namespace from parent class into
derived class, if they are not been used in derived.

Heres my example.
************************************************** ************
using System;
using System.Xml;

namespace TestMyApp
{
/// <summary>
/// Summary description for MyAbstractClass.
/// </summary>
public abstract class MyAbstractClass
{
public MyAbstractClass()
{
//
// TODO: Add constructor logic here
//
}

public virtual void TestMethod()
{
XmlDocument oNew = new XmlDocument();
}
}
}

************************************************** ***********
using System;

namespace TestMyApp
{
/// <summary>
/// Summary description for MyChild1.
/// </summary>
public class MyChild1 : MyAbstractClass
{
public MyChild1()
{
//
// TODO: Add constructor logic here
//
}
public override void TestMethod()
{
base.TestMethod ();
}


}
}
*************************************************
So i am not using XML in my child class and hence no directive.

i hope we r on the same page n this helps.

-
shashank kadge

Mar 2 '07 #2

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

Similar topics

88
by: Tim Tyler | last post by:
PHP puts most of its functions into a big flat global namespace. That leads to short function names - but creates a namespace minefield for programmers. Lots of the functions are legacies from...
2
by: Tim Mackey | last post by:
hi folks, i'm puzzled over this one, anyone with some solid db experience might be able to enlighten me here. i'm modelling a file system in a database as follows, and i can't figure out to...
1
by: Steve George | last post by:
Hi, I have a scenario where I have a master schema that defines a number of complex and simple types. I then have a number of other schemas (with different namespaces) where I would like to reuse...
6
by: Don Wash | last post by:
Hi There! I just need some advice on Namespace management for creating reusable VB.NET applications. I would like my applications to have this namespace structure... Namespace MyCompany ...
6
by: Johnny van Cadsand | last post by:
Hi, I know how inheritance works. But do i have to put all the inherited class files in the same directory as the class file which inherits is in?? (VB.NET) When i have a baseclass which i...
6
by: Martin | last post by:
Hi, I have a xml file like the one below <?xml version="1.0" encoding="utf-8"?><e1 xmlns:e1="http://tempuri.org/Source1.xsd" e1:att1="1" e1:att2="2" e1:rest="345"/> If I try to create a...
2
by: Mr Wizard | last post by:
I am going through the front controller http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpatterns/html/ImpFrontControllerInASP.asp and all works well except when the server.transfer...
5
by: Invalidlastname | last post by:
Hi, I just read the pattern "Design and Implementation Guidelines for Web Clients" from MSDN. Here is my question. In chapter 3,...
18
by: desktop | last post by:
I have 3 types of objects: bob1, bob2 and bob3. Each object is identified by a unique ID which gets returned by the function getId(). All bobs are descendants from class BaseBob which is an...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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...
0
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,...
0
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...

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.