Class terms in Dart
- members: variables in class including instance variables, static variables, constructors, static methods, and instance methods.
- members are: fields (non-static variables declared in a class, properties are the same as fields), methods
(fields/properties are also often called attributes but I think this should avoided in web development because attributes usually refers HTML attributes). - variables are not considered members except when they are fields
- I would not consider static fields (properties/functions) members in Dart (but I'm not sure about this too). They are sometimes referenced as class members or static members but in Dart the class is merely as a namespace and these variables functions don't act like members.
- constructors are not members
- members are: fields (non-static variables declared in a class, properties are the same as fields), methods
- properties: instance variables among members in a class and in an instance.
- as far as I know are properties the same as fields. Often properties refers to getters/setters only but in Dart they are the same, at least at runtime (getters/setters are automatically created for all fields)
- I'm not sure what you mean by
class
here. Class usually refers to statics (see above) - getters/setters (functions that can be accessed like fields) are usually seen as properties
- fields: members except methods in a class.
- I would only call instance variables fields and static variables static fields
- variable: denoting the name of an instance initialized, or an instance not yet initialized but with class definition including dynamic.
- variable is a declared identifier that refers a memory address no matter where (library, class, instance, function, method).
- A not yet initialized variable refers no valid memory address ('null').
- functions: all terms those can have more than zero parameters, including methods.
- The number of parameters is not relevant.
- Functions can be called using
()
or(arg1, arg2, ...)
- Non-static functions in a class are usually called method not function.
- Functions are outside a class at library level, or within a method or function (not sure whether static methods are referred as function or method in Dart).
void someFunction() => doSomething();void someFunction(int a) { doSomething(); }class A { void someMethod() { var anonymousFunction = () { doSomething(); }; anonymousFunction(); }}
- methods: functions defined and declared in a class including constructors, static methods.
- see above about static methods
- constructors are not methods, constructors are constructors ;-)
- objects: all the terms in Dart except conjunctions(if, while, for ...) and adjectives(static, final...)
- only instances of a class are objects
var a = new A();
new A();
creates an instance of A
. a
refers an instance of a
(object).
var x = 5;
creates an instance of int
and x
refers this instance (object).