Chapter 3 Quick Reference

JavaScript EditorJavascript debugger     Javascript examples


Team LiB
Previous Section Next Section

Chapter 3 Quick Reference

To

Do this

Code

Declare a variable

Use the data type, followed by the variable name.

int MyInt;

Modify the accessibility of a variable or procedure

Use the public, private, internal, or protected keywords

public void myProc()
{
}

To use structured exception handling

Create a try…catch…finally block.

try
{
// Code to try
}
catch ( System.Exception )
{
// Handle error
}
finally
{
// Code that will ALWAYS run }

Inherit from a base class

Append the base class name to the name of the derived class, separated by a colon

class Dog : Animal
{
}

Declare a method that will be overridden in classes that descend from the current class

Use the virtual modifier

public virtual void myProc()
{
}

Override a method declared in a base class

Use the override modifier

public override void myProc()
{
}


Team LiB
Previous Section Next Section


JavaScript EditorJavascript debugger     Javascript examples