Why do we use structure, property or Enum syntax? [closed] - vb.net

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I think it's substituable for just Dim, Public or others.
What is merit by using structure, property ??

All of these things you mention have different purposes.
Dim is used to create a local variable, which only exists in the function (method) you declare it in.
Public creates a member variable in a class. And it is accessible outside of the class.
A structure is like a class, but the differences between structs and classes depend on the language. In .NET, structs are value types, where as classes are reference types. See this for more information.
A property is like a public field, except it is modified through dedicated getter and setter 'functions'. These allow you to specify what is done with a value from a user, or how to calculate a value to return to the user.
An Enum is just an organized collection of constants, with a related purpose.
I think you should have a good read through an introduction on Visual Basic .NET like one of these:
http://visualbasic.about.com/od/learnvsnet/a/blecvbnet20101.htm
http://howtostartprogramming.com/vb-net/
http://www.java2s.com/Tutorial/VB/CatalogVB.htm

Related

Visual basic (Of T, or Of V) [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
When creating classes or other elements in VB.NET, for example :
Public Class Class1(Of T)
End Class
What does "(Of T )" mean in this code ?
(Of T) is a generic type parameter. It means that you can:
Refer to T in the class code, without knowing the type of T.
Construct instances of class Class1, passing any Type T into it.
This is used to construct classes, that can operate on different types, without knowing the type at compile time. This is, among other things, very useful for collection classes, where you are able to create the collection once (Example: List), and then create a List (Of String) or List(Of DateTime) and so on, for any specific type you might need.
Also, see this MSDN article on generics in VB.NET.
It means type parameter, it means that this class is capable of working with objects of a class that you specify during creation. For example List (Of T).

Objective-C: Generic Pointers in practice [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Namaste! How often do you, experienced guys using generic pointers in daily routine and what's the common purpose for generic pointers in cocoa-touch development?
EDIT
A variable declared as a pointer to void is a generic pointer.
There's such thing. It may be set to an address of any variable type. I just want to know how the people use this kind of pointers in real life coding.
P.S Thank you for down voting.
There are fewer and fewer cases where void* is appropriate in ObjC. They're still used for some things like context pointers for KVO, but with the addition of ARC they're a pain to use even for that. Basically, if you need to ask when you would use a void*, you probably shouldn't use a void*. They're a little more common in the callbacks of Core frameworks, again usually for context pointers.
But to the question, "How often do you... [use void*] ... in daily routine," the answer is "very seldom, and as little as possible."

why do you have to write interface and implementation in objective C instead just implementation [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I would like to know, why is so important to write interface and implementation for every calss in Objective C. In other langauge this technique is only optional.
In Objective-C, writing an interface is also optional (so is declaring methods), although the compiler will likely warn you. Writing the interface permits somebody else to reuse the binary form of your code without having to recompile it; this way you can also hide the implementation details/the code from the one who reuses your class. Also, if only you use your own class, the compiler may need some information at compile time (although Objective-C is a dynamic language) about the classes you write -- in this case you can't include the whole implementation file as it would result in duplicating your entire class, redulting in a linker error. Same reason why there are header files for any C library out there.
Interface describes how other classes and their instances will interact with your class and its instances. You could just create implementation, but that would kind of defeat the purpose of OOP.

Explain class, method, function? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
I am not clear what these terms mean:
Class
Method
Function
Can you please explain these terms to me?
You should first begin with Object Oriented development (maybe http://en.wikipedia.org/wiki/Object-oriented_programming). Because the class, method and function topics are not Java-specific.
Then you can see how Java works and how to build classes with it.
A class is a way of representing a group of objects. Sun/Oracle describes more about a class in What is a class? For example a car is a class of motorized vehicles with four wheels (among other things)
A method is a section of code that is declared to take some arguments (things like numbers) and return a value of a given type. A method has a body that determines what it does. Other parts of your code can call that method, at which point the code in your method is run and the return value can be used by the code doing the calling.
The word function is not really used when discussing Java, but if it is used it is a synonym for method.

Which one is "better" code snippet? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 13 years ago.
Which code snippet is better? and How? ['Better' on the basis of, readability, debug, code standards etc...,]
Dim Name As String = Employee.Name
or
Dim Name As String
Name = Employee.Name
Combining declaration and assignement is generally thought to be the best approach (your first example)
Well as they are both equivalent and both very simple I would expect the compiler to reduce them to the same thing so neither is really better.
Personally I feel the second has its advantages in that you can create several variables of one type in one line of code and then initialise them one after the other which for readable code is my preference. But if you only have one variable to initialise then the first is nice and concise as well.
As long as there is no null / empty or content checking between declaration and assignment, I prefer option number 1. Easier to read and less clutter.