{
 "metadata": {
  "name": "",
  "signature": "sha256:661266ea5854f8cdb4c1381d519c16a00dd0491ecb04f34e084c46771d5dc464"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 11: Pckages: Putting Classes Together"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 11.1, page no. 198"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\"\"\"\n",
      "Note there are no packages in Python, a python program(file) can be used as a module in anoter Python program\n",
      "\"\"\"\n",
      "\n",
      "from package1 import *\n",
      "from package2 import *\n",
      "\n",
      "a = classA()\n",
      "b = classB()\n",
      "\n",
      "a.display()\n",
      "b.displayB()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Class A\n",
        "Class B\n",
        "m =  10.0\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 11.2, page no. 200"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\"\"\"\n",
      "Note there are no packages in Python, a python program(file) can be used as a module in anoter Python program\n",
      "\"\"\"\n",
      "\n",
      "from package2 import *\n",
      "\n",
      "class classC(classB):\n",
      "    n = 20\n",
      "    def displayC(self):\n",
      "        print \"Class C\"\n",
      "        print \"m = \", self.m\n",
      "        print \"n = \", self.n\n",
      "\n",
      "c = classC()\n",
      "c.displayB()\n",
      "c.displayC()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Class B\n",
        "m =  10.0\n",
        "Class C\n",
        "m =  10.0\n",
        "n =  20\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 11.3, page no. 204"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\"\"\"\n",
      "there is no concept of static import. We will use normal import instead\n",
      "\"\"\"\n",
      "\n",
      "import math\n",
      "\n",
      "class mathop:\n",
      "    def circle(self, r):\n",
      "        area = math.pi*r*r\n",
      "        print \"The Area of circle is: \", area\n",
      "\n",
      "obj = mathop()\n",
      "obj.circle(2.3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Area of circle is:  16.6190251375\n"
       ]
      }
     ],
     "prompt_number": 16
    }
   ],
   "metadata": {}
  }
 ]
}