11. Zeeshan Hanif Class Definition public class Car{ public static int wheel; public string color; public bool isAutomatic; } Car1 Color isAutomatic Car2 Color isAutomatic Each object gets its own copy Shared between all objects Car.Wheel Car objects wheel
12.
13. Class Members Zeeshan Hanif c1 instance Instance Fields color c2 instance Instance Fields color All Methods NoOfWheels() Start() Car Class Static Fields wheel
14. Defining Methods Zeeshan Hanif public int start(int a, string b,......) { // Executable code } The type of the value to be returned Name of the method The specification of the parameters for the method. If the method has no parameters, leave the parentheses empty Access modifier This is called the body of method Method Signature
15.
16.
17.
18. Properties syntax Zeeshan Hanif public class Student { private string name; public string GetName () { return name; } public void SetName (string a) { name = a; } } public class Student { private string name; public string Name { get { return name; } set { name = value; } }} Using Property Using Methods