Tutorial by Examples: class

The very first line in each of your LaTeX programs should do this. It should follow the form \documentclass{...}. What you put within the curly braces is very important. Some document classes give you extra commands to use, others use a different format, and all have specific parameters you can inp...
First Test.class: package foo.bar public class Test { } Also Test.class in another package package foo.bar.baz public class Test { } The above is fine because the two classes exist in different packages.
The reference to the outer class uses the class name and this public class OuterClass { public class InnerClass { public void method() { System.out.println("I can access my enclosing class: " + OuterClass.this); } } } You can access fields and ...
public class Main extends JavaPlugin { @Override public void onEnable() { Bukkit.getPluginManager().registerEvents(this, this); } @EventHandler public void yourEvent(Event e) { //... } }
Some applications may want to create so-called "Fire & Forget" tasks which can be periodically triggered and do not need to return any type of value returned upon completion of the assigned task (for example, purging old temp files, rotating logs, autosaving state). In this example, w...
ZeroR is a simple classifier. It doesn't operate per instance instead it operates on general distribution of the classes. It selects the class with the largest a priori probability. It is not a good classifier in the sense that it doesn't use any information in the candidate, but it is often used as...
It is often necessary to execute a long-running task and use the result of that task once it has completed. In this example, we will create two classes: One which implements the Callable<T> interface (where T is the type we wish to return), and one which contains a main() method. AsyncValueT...
class ParentClass { [string] $Message = "Its under the Parent Class" [string] GetMessage() { return ("Message: {0}" -f $this.Message) } } # Bar extends Foo and inherits its members class ChildClass : ParentClass { } $Inherit = [ChildClass...
[DscResource()] class File { } This example demonstrates how to build the outer section of a PowerShell class, that declares a DSC Resource. You still need to fill in the contents of the class definition.
' How To Seek Past VBA's 2GB File Limit ' Source: https://support.microsoft.com/en-us/kb/189981 (Archived) ' This must be in a Class Module Option Explicit Public Enum W32F_Errors W32F_UNKNOWN_ERROR = 45600 W32F_FILE_ALREADY_OPEN W32F_PROBLEM_OPENING_FILE W32F_FILE_ALREAD...
We can create Singleton class in such a way that developers are forced to used the shared instance (singleton object) instead of creating their own instances. @implementation MySingletonClass + (instancetype)sharedInstance { static MySingletonClass *_sharedInstance = nil; static dispa...
Using the Flyable example as a starting point, we can add a second interface, Swimmable, with the following code: Sub Swim() ' No code End Sub The Duck object can Implement both flying and swimming: Implements Flyable Implements Swimmable Public Sub Flyable_Fly() Debug.Print &quo...
Lets following are the class definition class A def a; end end module B def b; end end class C < A include B def c; end end What are the instance methods of C? C.instance_methods # [:c, :b, :a, :to_json, :instance_of?...] What are the instance methods that declare...
var providerName = "System.Data.SqlClient"; //Oracle.ManagedDataAccess.Client, IBM.Data.DB2 var connectionString = "{your-connection-string}"; //you will probably get the above two values in the ConnectionStringSettings object from .config file var factory = DbProviderFac...
The most common way to add (and edit classes) in from the system browser In the Nautilus system browser have nothing selected or select a package (first column) or a class (second column). Depending on the selection, the code editor will display a slightly different class template: SelectionTemplat...
In Pharo everything is an object, and every object responds to messages. So if you evaluate the following code Object subclass: #MyClass the object Object will create for you its subclass called MyClass. If you don't have any particular superclass in your mind it's advised to subclass from Objec...
You can create classes without names that are not installed in the system by sending newAnonymousSubclass to a class. For example anonymousSet := Set newAnonymousSubclass will assign an anonymous subclass of Set to anonymousSet variable. Then you can compile methods in this class and instantiat...
The known sub-classes for Entity Events are: Sub-ClassesSub-ClassesSub-ClassesCreatureSpawnEventCreeperPowerEventEntityChangeBlockEventEntityCombustEventEntityCreatePortalEventEntityDamageEventEntityDeathEventEntityExplodeEventEntityInteractEventEntityPortalEnterEventEntityRegainHealthEventEntitySh...
Django Model Form with Django Class Based view is a classic way of building pages to do create/update operations in django application quickly. Within the form we can put methods to execute tasks. Its a cleaner way to put tasks in forms rather than putting in views/models. To give an example using ...
Built-in forms are great but sometimes there is a need to customize them, adding new fields or simply changing CSS attributes. This example is applicable to several use cases but here it is presented regarding PasswordChangeForm and its use in a Bootstrap website. The solution is to create another...

Page 23 of 28