473,587 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inheritance / file locations

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 want to use in different solutions, then
i add the class to a solution. The IDE copies the file to the other
solution folder and i have 2 copies of the same class file.

The idea of inheritance is reusable code, but when i have 2 identical
files on different locations do i have to edit them both when something
changes to my baseclass???

Should i use a dll? I know it's a possible solution but not the most nice
one.
Why hasn't MS thought about this?
Has anyone an explanation?

--

=============== =============== =============== =============== ==
Johnny van Cadsand news ( ) cadsand ! demon ! nl

..:: Up to the Sky and Back ::..
Nov 21 '05 #1
6 1147
They have thought about it. I don't know if you have.

If you add an existing class to a solution, all that means is that VS.NET
copies the file. This has nothing to do with code reusability. Because
then, anyone who wants to use your class, would need your source code??

You are supposed to compile the base class into a DLL, and then use the dll
in other projects. It is the perfect solution - and certainly a lot better
then having multiple copies of the source all over the place or having to
have the source code for a class in order to inherit from it. What company
is going to write a control, if the only way anyone can use it is to have
their source code?

"Johnny van Cadsand" <ne**@nospam.ca dsand.demon.nl> wrote in message
news:Xn******** *************** *********@216.1 68.3.44...
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 want to use in different solutions, then
i add the class to a solution. The IDE copies the file to the other
solution folder and i have 2 copies of the same class file.

The idea of inheritance is reusable code, but when i have 2 identical
files on different locations do i have to edit them both when something
changes to my baseclass???

Should i use a dll? I know it's a possible solution but not the most nice
one.
Why hasn't MS thought about this?
Has anyone an explanation?

--

=============== =============== =============== =============== ==
Johnny van Cadsand news ( ) cadsand ! demon ! nl

..:: Up to the Sky and Back ::..

Nov 21 '05 #2
Marina wrote :
They have thought about it. I don't know if you have.

If you add an existing class to a solution, all that means is that
VS.NET copies the file. This has nothing to do with code reusability.
Because then, anyone who wants to use your class, would need your
source code??

You are supposed to compile the base class into a DLL, and then use
the dll in other projects. It is the perfect solution - and certainly
a lot better then having multiple copies of the source all over the
place or having to have the source code for a class in order to
inherit from it. What company is going to write a control, if the
only way anyone can use it is to have their source code?

Alright...

That's what i thought but it looked strange to me that file copied...

But indeed, you don't need the source!!

Thanks...

--
=============== =============== =============== =============== ==

Johnny van Cadsand news ( ) cadsand ! demon ! nl

..:: Up to the Sky and Back ::..
Nov 21 '05 #3
"Johnny van Cadsand" <ne**@nospam.ca dsand.demon.nl> schrieb:
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 want to use in different solutions, then
i add the class to a solution. The IDE copies the file to the other
solution folder and i have 2 copies of the same class file.
Add the class to one project of type "Class Library" and reference this
project (DLL) from the other projects.
Should i use a dll? I know it's a possible solution but not the
most nice one.


Why not? Sure, for a single class, it doesn't make much sense, but if there
is a set of classes I would add them to a class library.

VS.NET provides a way to reference the file instead of creating a copy of
it: "Project" -> "Add Existing Item..." -> Change the button labeled "Open"
to "Reference File" and press it.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #4

"Johnny van Cadsand" <ne**@nospam.ca dsand.demon.nl> wrote
I know how inheritance works.
OK, now concentrate on learning how to use the tool.... ;-)
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)
No.

When i have a baseclass which i want to use in different solutions, then
i add the class to a solution. The IDE copies the file to the other
solution folder and i have 2 copies of the same class file.
Yes, it will do that if you tell it to.

The idea of inheritance is reusable code, but when i have 2 identical
files on different locations do i have to edit them both when something
changes to my baseclass???
That's not how I'd do it.

Should i use a dll? I know it's a possible solution but not the most nice
one.
Well yes, you should fully design your base class before you put it to
use in a bunch of other apps, but you don't have to.
Why hasn't MS thought about this?
What makes you say that? Again, you should really check into what
the tools can do for you, before you ask why they haven't provided
what you need. What you apparently want is provided for, and its
called linking. You can link any file to your current project simply
by telling VS to link the file.
Has anyone an explanation?


When you link a file to your project, it is left in its original directory
and becomes a part of your project, just like the other files. Changes
you make (and save) to the file are reflected back to the original file
in its original directory.

LFS
Nov 21 '05 #5
Larry Serflaten wrote :
When i have a baseclass which i want to use in different solutions,
then i add the class to a solution. The IDE copies the file to the
other solution folder and i have 2 copies of the same class file.


Yes, it will do that if you tell it to.


I just add an existing class from an other solution to my solution and
the IDE copies it.
I found that...
in a classlibrary it copies the original file but when i add an existing
class to a windows application project it is left in its original
directory and indeed the changes are reflected back to the original
file...

But nevermind the above...

I wonder why it default copies the file when you can link it as well. And
only in a classlibrary.

--
=============== =============== =============== =============== ==

Johnny van Cadsand news ( ) cadsand ! demon ! nl

..:: Up to the Sky and Back ::..
Nov 21 '05 #6

"Johnny van Cadsand" <ne**@nospam.ca dsand.demon.nl> wrote
I wonder why it default copies the file when you can link it as well. And
only in a classlibrary.


I certainly don't know for sure, I wasn't making the decisions, but I
would suppose that it was determined that over the long haul, in
most cases, copying the file instead of linking, would be the choice
most often selected.

You can link the file you want by selecting to add an existing item,
and instead of just clicking on the Open button, click on the down
arrow beside the word Open, and select Link File....

LFS
Nov 21 '05 #7

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

Similar topics

2
4366
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two files containing some templates: adjacency_list.hpp and mem_fn.hpp can not compile. Does anyone have any solutions?
6
1897
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 want to use in different solutions, then i add the class to a solution. The IDE copies the file to the other solution folder and i have 2 copies of the same class file.
3
2559
by: Hazz | last post by:
I am just beginning to design a Treeview display (winforms) for wine regions. Problem. Some wine growing regions belong to two counties. Eg. Carneros is in both Napa and Sonoma Counties. Although most nodes will have only one parent, a few will have two parents. The Treeview which seems to me to lend itself to the Windows Explorer type of app could not possibly show one file as a leaf belonging to two different parent folders. You either...
3
1722
by: Chris Kennedy | last post by:
What's the difference between importing a namespaces and inheriting.
4
12935
by: NileshKorpe | last post by:
Can Somebody please point some of the dis advantages of multiple inseritence. Thanks Nilesh Korpe
3
1672
by: A_Republican | last post by:
I am interested in writing my own secure file deletion program. I want to be able to read and write to my hard drive directly. My application will seach my hard drive for all locations marked for deletion and then replace it with "x" or something that securely removes previoius data. My question is what objects, API calls, etc, etc do I use to read and write directly to the hard drive? -- Regards, Shaun Goldston
0
1841
by: jephperro | last post by:
Hi, I'm trying to do something with multiple xml files and am wondering if it is possible. I have 2 XML feeds: One is a list of locations, LOC.XML One is a list of products,PROD.XML I have 2 separate XSL files.
0
972
by: PFancy | last post by:
Hi, Not sure if anyone can help. I have writen some code that will allow users to edit a txt file (it's actually an xml file) in notepad. I can get notepad to open correctly with the correct file, but once changes have been made and you want to save the file it errors with "Cannot create the Locations.xml file. Please check that the filename and path are correct. I have checked these and they seem fine. It would seem that the file is still...
3
1785
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post by:
Hi all It is maybe a stupid question, but I have some trouble with Inheritance. For example: I create a new class with one form. On this form I place on the bottom a Panel and on this Panel on the right side a button. On both controls I set Anchor (bottom, right).
6
4933
by: Laphan | last post by:
Hi All I can't get round this because it's a local government thing, but I've done a CMS for a school (in ASP classic) that allows them to upload gifs, jpgs, pdfs and docs to their site for the usual CMS stuff. Works fine on my host as I use ASPupload and I have one FTP location for my data, but I've now found out that I've got to put the site on the local government's servers and they only provide the following setup:
0
7923
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
8216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7974
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8221
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...
1
5719
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
5395
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
3845
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...
1
2364
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
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.