Django Framework Boot Camp

Review of Object Oriented Programming, Classes and Objects

Objects are Instances of a Class

Classes and Objects

Classes & Encapsulation

A Class is a template of an object. It represents data.

Encapsulation: Class wraps properties and methods together

Objects are Instances of a Class

Object Oriented Programming

object.attributeexpression

Classes  Serve as instance factories. If classes are cookie-cutter.

Instances If classes are cookie cutter, Instances are cookies.

class C2: ... # Make class objects (ovals)

class C3: ...

class C1(C2, C3): ... # Linked to superclasses

I1 = C1() # Make instance objects (rectangles)

I2 = C1() # Linked to their classes

classes are really just packages of functions

classes support code reuse and customization of software

Coding Constructors

Define a constructor with the __init__ constructor method

Assign the 1st argument to self in the __init__ constructor method.

Let’s add one to our class:

Next, assign each self.attribute to each argument For Eg. self.name = name

Item Class

Vehicle Class

Object Oriented Programming - Class

Object Oriented Programming - Objects

Please login to get access to the quiz
Object Oriented Programming Concepts (Prev Lesson)
(Next Lesson) Inheritance
Back to Django Framework Boot Camp

No Comments

Give a comment

Course Curriculum

Instructor
Ajitkumar-Poolathodiyil
Ajitkumar Poolathodiyil
Role : Various Technical Leadership Positions
  • Website : http://infosure.in/
  • Experience : 25 Years
  • Specialist in : Python, Data Sciences, ReactJS, Oracle E-Business Suite R12, Odoo, Oracle Fusion, Oracle Policy Automation, Endeca
Read More