View Full Version : VB.NET questions


TheDon
06-19-03, 05:00 AM
Can anyone explain to me, in simple terms, what a Namespace is and what it is used for. And also what a Constructor is and what it is used for. I dont have much of an idea, and they are constantly being refered to in my book/lectures/etc.

Thanks heaps

AntonK
06-19-03, 08:13 AM
Ahhh...all the changes in VB.net from VB 6. Those are concepts in object oriented design. If you look that up on the internet you should be ok. A namespace is kind of like an overall classification system to put things into, that way u can have 2 of the same thing. and still differentiate. I'm not sure the syntax for VB.net but in C++ you can do something like namespace1:myfunction() and namespace2:myfunction() . Although the functions have the same name, they are in different name spaces which means you can differentiate between them.

A constructor is a function that is called when an object is being created. An object is an instance of a class. A class can be something like car. Car is a type of something, when you create a particular one you could name is (again...in c++) Car* vinABCDEFG = new Car(RED, TWO_DOOR, HATCHBACK); The constructor is the stuff with the information. We want to "construct" the car, we tell it its red, has two doors, and is a hatchback. There is also destructors, but probably not in VB.net since I believe memory managemnt is dont for you.

-AntonK

Blindman
06-19-03, 08:26 AM
In the most simple of terms. Namespace is just like a directory structure. It provides a method to reference classes, interfaces, types and more. Generally used in Object oriented languages. XML also uses namespaces to define data structures.

Constructor has a few meanings in programing.

When you define a class you must provide a constructor. It is the code that is run when you first create the class.

Blindman
06-19-03, 08:28 AM
AntonK. Dang you got in first...

AntonK
06-19-03, 09:25 AM
hehe...i always try to answer questions when I actually know the answer :)

-AntonK

Blindman
06-19-03, 10:32 AM
Antonk.. Come now do you dislike me so much.
Prove me wrong.. Or just make another personal slur.

if(AntonK != NULL)
{
delete AntonK;
}


Waiting for the moderators to step in..

AntonK
06-19-03, 10:54 AM
No no no...please...you misunderstand. That was a comment about myself. Sometimes language does not translate as I would like it to on a message board. I meant simply that I don't know the answer a lot of the time, so when I do, I simply jump on the chance to answer it. I didn't mean to infer you didn't know the answer. It's quite obvious we are of different mindsets on computers. I have no problem. I'm here for debate. I respect your opinion, moreso even than my own considering you are most likely older and more experienced in industry.

-AntonK

Blindman
06-19-03, 11:08 AM
I apologize to you.. I was to quick to take offence..

Sorry. Good night and look forward to the next debate.

Mutual respect
Blindman.

AntonK
06-19-03, 11:18 AM
Blindman:

Not a problem. Things like that happen online.

AntonK = new Human("AntonK");
AntonK->forgive(Blindman);

----------------------------------------------------------------------------------

TheDon:

Did we answer your question ok?

----------------------------------------------------------------------------------

-AntonK

TheDon
06-19-03, 10:13 PM
Originally posted by AntonK
Blindman:

Not a problem. Things like that happen online.

AntonK = new Human("AntonK");
AntonK->forgive(Blindman);

----------------------------------------------------------------------------------

TheDon:

Did we answer your question ok?

----------------------------------------------------------------------------------

-AntonK

Yes you did, couldn't have asked for it any better. Thanks people.

Xerxes
06-20-03, 11:37 AM
I've never seen anybody swear at another person in Java...

And then make up in, is that C++? -I'm an inexperienced programmer.
:bugeye:

TheDon
06-29-03, 07:06 AM
Just thought I might say that thanks to your help, I went awsome on my exam. It might sound stupid, but when most of the subject revolved around knowing these 2 little things, after finding out what they were exactly, everything fell into place. So thanks!