Hi Chris,
These two things are in theory very different, although it might look
like they are sort of having a similar effect. I'm not sure that the
straightforward answer will actually help you very much because if you
haven't ever come across it before the concept is a bit complex.
Importing (adding an Imports reference to the top of a class file) is a
kind of "reference" from your file to a specific namespace. The simple way
to understand it is by example:
Without importing any namespaces into my file I might want to refer to a
class within the system.web.util namespace - to do so every time I referred
to it I would need to write:
dim XXX as system.web.util.transactions
If I add the line Imports system.web.util at the top of my file I can refer
to it simply as
dim XXX as transactions
Inheritance is totally different. Inheritance is a way of
"compartmentalising", sharing, reusing and organising chunks of code into
"objects" (classes). When I say:
Public Class MyCustomControl : inherits Webcontrol
Then I'm using inheritance - what I'm doing is saying "here is a blueprint
for a MyCustomControl - it's a type of WebControl, so it shares everything
that a webcontrol has, but with additions and differences". A really good
book on inheritance and object orientated programming is (in my opinion)
Thinking in Java by Bruce Eckel. I know java is mud - but Bruce Eckel is
very very good at helping you to "think" in object orientated ways rather
than just learn about how it works.
As always I stand ready to be corrected by someone more knowedgeable than
me - but this is my understanding of the differences between imports and
inheritance. Anyone else care to comment?
Nick
"Chris Kennedy" <ch**********@cybase.co.uk> wrote in message
news:el*************@TK2MSFTNGP12.phx.gbl...
What's the difference between importing a namespaces and inheriting.