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.
Related
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.
This may be trivial. I'm wondering if you can pass an object as parameter to a function, then function can operate on the object and then return the same object back. I've got a work around for this, but would like to know if there is a way to do it.
An Example:
-(objectA *)aFunctionWithParameter:(objectA *)param
{
//...Operate on param
return param;
}
Yes, you can do it.
In objective-C, the pointers are passed by reference. So, when you change any fileds of an object received as a parameter of your function, you are modifying the actual object. On returning it, you will have updated object.
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).
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.
can you give me a idea about the following program:
There is vehicle factory. The common attribute of all the vehicles are that they can run. Building the basic structure of any vehicle, it is required to pass wheel count, wheel size and factor. The max speed is defined by the multiplication of wheel count, size and factor.
The factory can build: Cycle, MotorCycle, Car, Bus.
When those vehicle run they print <Vehicle Name>can run at speed<Max Speed>
Please write a program using OO approach.
Factor:Cycle=1,MotorCycle=2,Car=4,Bus=6
Wheel Size:Cycle=10, MotorCycle=12, Car=12, Bus=20
What is the best way to do this?
Read between the lines:
They can run: refers to a method.
Building the basic structure: refers to a constructor, in fact it sums up the constructor parameters.
The max speed is defined by the multiplication of ...: a calculated property.
The factory can build ... sums up the subtypes of Vehicle. (As you already understood).
When those vehicle run they ... : tells you what the run method should do.
Then the constructor parameters are given, assuming you can figure out the wheel count.
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.
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