Classes

Classes encapsulate the characteristics and capabilities of a type in a single, self contained unit
Allows you to encapsulate the data and the behaviour of an object in one place
Class modules allow you to create your own datatypes
Lets you define methods, properties and events


An object is an instance of a class
The behaviour a class is defined by the methods of that class.




public delegate void delMyDelegate(string sVariable); 
public delMyDelegate objDelegate;
objDelegate("string")

public delegate void delMyDelegate(object sender, EventArgs e);
public event delMyDelegate objDelegate;
protected virtual void OnRestore(EventArgs e)
{
   delMyDelegate(this, e);
}


Virtual

me

base.Dispose(disposing)

public static clsMyClass

public static string MyVariable;

public static MyMethod()

clsMyClass.Mymethod()

public override object DefaultNewRowValue
{
}

public clsDataGridViewColumn_2() : base(new clsDataGridViewTextBoxCell_2)
{
}

if myObject is clsClass
{
}


[System.ComponentModel.Browsable(false)] 
[System.Serializable()]


Creating an instance of a class allows you to call other members on the object


Methods

There is a fundamental difference between a method's visibility and its accessibility
Any method in a class declaration is visible (regardless of its protection level)
For a derived class to override a method it just has to be visible, not accessible
Members are accessible through object references
Methods, properties and indexers have an implied "this" reference




© 2017 Better Solutions Limited. All Rights Reserved. © 2017 Better Solutions Limited

Next