Docsity

OOP Concepts in Python: Classes, Objects, Inheritance, Study notes of Software Engineering

Partial preview of the text

Download OOP Concepts in Python: Classes, Objects, Inheritance and more Study notes Software Engineering in PDF only on Docsity!

CLASS &

OBJECTS

P.Raja, Assistant professor in ES(D4), SEEE, LPU

OUTLINE

 OOP Terminology  Creating classes  Creating instance objects  Accessing attributes  Class Inheritance  Overriding methods  Data hiding  Function overloading

OOP TERMINOLOGYFunction overloading − The assignment of more than one behavior to a particular function. The operation performed varies by the types of objects or arguments involved.  Instance variable − A variable that is defined inside a method and belongs only to the current instance of a class.  Inheritance − The transfer of the characteristics of a class to other classes that are derived from it.  Instance − An individual object of a certain class. An object obj that belongs to a class Circle, for example, is an instance of the class Circle.

OOP TERMINOLOGYInstantiation − The creation of an instance of a class.  Method − A special kind of function that is defined in a class definition.  Object − A unique instance of a data structure that's defined by its class. An object comprises both data members (class variables and instance variables) and methods.  Operator overloading − The assignment of more than one function to a particular operator.

 Every object has the following property.

  • (^) Identity : Every object must be uniquely identified.
  • (^) State : An object has an attribute that represents a state of an object, and it also reflects the property of an object.
  • (^) Behavior : An object has methods that represent its behavior.

Class : Person

  • (^) State : Name, Sex, Profession
  • (^) Behavior : Working, Study  Syntax to create a object Object_name=class_name(arguments)