Skip to main content

Object Oriented Programming Using C# - Step 1

Object != Class

A class is code which contains properties (data management)and functions (actions on that data).

Sample Class : 

Public class Customer 
{
     public string FirstName {get;set;}  //property
     public int Age {get;set;}  //property
     
     public int ValidateAge();  //functions
}

An object is an instance of a class .It is created using a new keyword .

Sample Object : 

var sampleObject = new Customer();

Hint : On terminating an application , the instance i.e object state is gone but the class still exist . Once a class is created we can any number of unique objects from the class with different decorations (properties and functions ) .


Oh !! that's pretty simple , but is business object referred to as a class !! Yeah that's correct .So we are pretty clear about what a class and object are and how they differ . This starting knowledge is enough to go from here .

Let's now start to put our efforts together in understanding what OOP is , yeah you read it right , Welcome to Object Oriented Programming .

OOP is an approach to designing and building applications that are : 
  • Flexible 
  • Natural 
  • Well-Crafted 
  • Tested
by focusing on objects that interact cleanly with one another .

Now to put that in practice lets start a customer management system !! Before that , we can have break here and can analyze on what are classes for such a product !! See you at the next blog , keep coding .

Comments