Saturday, May 30, 2009

Scared on OOP.....

Hay guys, You might be thinking why I am back on my blog after a long time. It's simply b'cause the encourage I got from one of my friends called Gogula and I use to call him gogus most of the time. Thanks man. Ok, here I start it again with OOP & C# .

Before I start anything on this topic let me explain what is an object.

What is an object?

Ha, that could be anything around you in real world. For example your CPU.

What we should consider of an object as a programmer? It's state and the behavior.
I wil just take a scenario that would helpfull you to understand as a programmer, what is an object?. If you were asked to develop a student enrolment application what would you conside as your objects in this application. I will point two objects Student and the Course but there are many more, I will leave you to point after reading this blog.

As I have mentioned above we bothered about state and the behavior of an object.
An object's state is the data and information it contains. For example, If you have a CPU object, it's state could be RAM speed and hard disck capacity. An object's bahavior represeted by it's methods. For example, in your CPU object play movie could be a method.

There are three underline concepts


Encapsulation is a process of binding both data and methods together inside of an object.
Protection and information hiding are techniques used to accomplish encapsulation of an
object. Conside the following Class.

public class Box{
public Box()

protected double height;
protected double width;
protected double length;

public double GetVolume()
double volume = height*width*length;


return volume;


My Achievements

Member of

Blog Archive