In this article we will understand some of the concepts of object-oriented programming in C# like objects and classes. To read this article you must have C# programming basics.
NOTE: read the whole article because there aresome concepts you may will not get the best of it until you finish the article.And we will revisit all the concepts more than one time when I see it’sappropriate in future articles so don’t worry at all.
Introduction:
OOP stands for Object-Oriented Programming. OOP isrelatively a new way to program computer applications. Before OOP programmersused to creating computer applications using procedural-programming (orstructure-programming) but when OOP solved a lot of the problems of theprocedural-programming so almost all of the programmers and developers beganusing OOP languages. In procedural- programming all the program functionalitywritten in a few modules of code or maybe one module (depending on the program)and these modules depend on one another and maybe if you change a line of codeyou will have to rewrite the whole module again and maybe the whole program butin Object-Oriented Programming programmers write independent parts of a programcalled classes each class represent a part of the program functionality andthese classes can be assembled to form a program and when you need to changesome of the program functionality all what you have to do is to replace thetarget class which may contain a problem. So in OOP applications create by theuse of classes and these applications can contain any number of classes. Thatwill get us to discuss the Class and Object concept.
Classes and objects:
You may find it not easy to understand the class and objectstory but I will try to do my best explaining it. Actually the class and objectconcept is related to each other and some beginners don’t care aboutunderstanding it clear so I think they will have a hard times learning C#.<o:p></o:p>
Object-Oriented concept takes the most of its functionalityfrom the real-life concepts. For example, I will discuss the concept of Classesand Objects of the world first and then you will understand the computer’sClasses and Objects before I even write anything about it.<o:p></o:p>
World’s Classes and Objects:
In our world we have a classes and objects for thoseclasses. Everything in our world considered to be an object. For example,people are objects, animals are objects too, minerals are objects, everythingin the world are objects. Easy right ? but what about classes. In our world wehave to differentiate between objects that we are living with. So we mustunderstand that there are a classifications (this is how they get the nameand the concepts of the Class) for all of those objects. For example, I’man object, David is object too, Maria is another object so we are from apeople class (or type). I have a dog called Ricky so it’s an object, Myfriend’s dog called Doby is also an object so they are from a Dogs class (ortype). A third example, I have a computer Pentium III this is object, Myfriend have a computer Pentium IIII so this is another object and they are froma Computers class (or type). Now I think you got the concept of theClass and Object but let me crystallize it for you. In our world we have aclassifications for objects and every object must be from some classification.so a Class is a way for describing some properties and functionalities orbehaviors of a group of objects. In other words, The class considered to be atemplate for some objects. So maybe I will create a class called person so thisis a template of the functionality and the properties of persons. I explainedit by more than a way so wait until you see the first example and I think youwill grasp it completely.<o:p></o:p>
Computer’s Classes and Objects:
Computer’s Classes discussion is similar to what you graspfrom the last section with some modifications to become computerized.
Continues…
No comments:
Post a Comment