Re: OO is not that great: many repeated codes
- From: Bruno Desthuilliers <bdesth.quelquechose@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 26 Sep 2006 23:34:10 +0200
Daniel T. a écrit :
(snip)
I don't feel like others directly addressed the example...
(Python)
class Student:
def driveCarWell(self):
pass
class HouseWife:
def cookDeliciousFood(self):
pass
class Calculator:
def average(self, firstNum, secondNum):
pass
class Professor (Student, HouseWife, Calculator):
pass
Where's the duplication?
I'd certainly not implement it this way in Python.
def driveCarWell(self):
pass
def cookDeliciousFood(self):
pass
def average(self, firstNum, secondNum):
pass
class Student(object):
driveCarWell = driveCarWell
class HouseWife(object):
cookDeliciousFood = cookDeliciousFood
class Calculator(object):
average = average
class Professor(object):
driveCarWell = driveCarWell
cookDeliciousFood = cookDeliciousFood
average = average
Python's functions *are* objects...
.
- References:
- OO is not that great: many repeated codes
- From: Shawn
- Re: OO is not that great: many repeated codes
- From: Daniel T.
- OO is not that great: many repeated codes
- Prev by Date: Re: Abstract public member variales?
- Next by Date: Re: OO is not that great: many repeated codes
- Previous by thread: Re: OO is not that great: many repeated codes
- Next by thread: Re: OO is not that great: many repeated codes
- Index(es):