oop intro
DESCRIPTION
Object Oriented Programming IntroductionTRANSCRIPT
Object Oriented Analysis & Desigh
Object Oriented ProgrammingBy: Irfan U. MemonB.E (Software engineering)Mehran UET. JamshoroFoundations of Programming Programming Fundamentals
Prerequisites Programming ParadigmsObject Oriented Programming (OOP)?Need of OOPClasses Objects How to create Objects
OutlinesAprogramming paradigmis a fundamental style of computer programming, a way of building the structure and elements of computer programs.
Two Programming Paradigms Structural Programming Object Oriented Programming.
Programming ParadigmsDataLogicDataLogicDataLogicWhat Object Orientation is ?
Programming ParadigmNot a programming Language.Set of Ideas that is supported by many programming languages.e.g C++, Java, C#, Php, Objective-C (Many others)Object Oriented Programming Languages.Object Oriented Programming (OOP)What is An Object?
What are object in real world?ThingsIs this desk? This Computer? A Pen?They are all objects, these are all things.Objects are separate from one anotherThey have their own existenceObjects have AttributeA computer can be on or offA pen can be blue or blue These are the attributes of any object Things like color, weight, and size They describe the current state of an ObjectState of on object is independent of other We turn on PC on, it does not turn all PCsObjects are instances of Class.Things that have Identity, Attribute & behavior.An object is basically a block of memory that has been allocated and configured according to the blueprintObjects in Computer
An object is anything that can be modelled as data (properties) and operations on that data (methods).Objects in Computer
In real world Objects are tangible things Where as in computers objects can be intangible things also
Balance: Rs: 15000Number: 36-5
Deposite()Withdraw()Name: AliGender: Male
walk()talk()Name: SabaGender: Female
walk()talk()Bank Account ObjectPerson ObjectPerson ObjectWhat is a Class?
Class
Classes are templates or blueprints which are followed to create an Object.A detailed description or definition. A is not an object it self.
What does a class Describe
Attributesname HeightWeightGenderageBehavior WalkRunJumpSpeaksleepWhat does a class Describe
Propertiesname HeightWeightGenderageMethodsWalkRunJumpSpeaksleepObject Oriented Paradigm
AbstractionPolymorphismInheritanceEncapsulation
AbstractionFocus on the essentialsIgnore the Irrelevant Ignore the unimportantNot the separate class, one generalized classFocuses on how our class would look like rather than what is our class
Encapsulation Idea of surrounding somethingBundling the attributes and behavior in the same class.Also want restrict access in or out of the class. (Data Hiding)Black Boxing.Why Hiding?
Inheritance Creating a class based on another classCode Re-useBase Class is know as Super classNew formed class as Child Class
PolymorphismPoly Many, morph shapes
It enables us automatically do the correct behavior even if what we are working with can take many forms.
(+) sign
Methodsmethod is a code block that contains a series of statements
Every C# program has at least one class with a methodmain methodTo Use method we need two things Defining a MethodCalling a Method
Defining Methods in C#The syntax for defining a method in C# is as follows (Parameter List){Method Body}Types of Methods ProcedureA method is known as procedure if it does not return any valueORIf its return type is void FunctionA method is known as function if it do returns any valueORIf its return type is not void