|
Authored by: Ian Al on Monday, May 07 2012 @ 03:03 AM EDT |
In the real world, a class is a classification. A box of frogs contains green,
tree and poison frogs. If one is looking for a box to put your frogs in, you
look for the one labelled 'Frogs'.
My big book about Python says
this:Class objects provide default behaviour and serve as factories
for instance objects. Each time you call a class, you get a new instance of that
class.
You can see why I thought objects created by class calls
acquire the properties of the class. In Python, class objects acquire the
attributes of the classes above it in the hierachy.
I stole this from
another comment.The members of a class type are classes, interfaces,
fields, and methods. Members are either declared in the type, or inherited
because they are accessible members of a superclass or superinterface which are
neither private nor hidden nor overridden.
The members of a class type are all
of the following:
Members inherited from its direct superclass, if
it has one (the class Object has no direct superclass)
Members inherited
from any direct superinterfaces
Members declared in the body of the
class
From what you say (save for interfaces), all Java classes
dangle, directly or indirectly, from the Object class. Looking at the Google
opening slides, they give the
example:
java.lang.Math.max()
Package(java.lang). Class(Math).
Method(max())
I assume that Math is a class object and has Object as a
superclass. Is the 'inheritance' just that the designer has decided that it
suits him for max() to be in the Math class and have access to other members of
the class and of members in its superclass tree?
Object orientation is
optional in Python. If you just want a box of frogs... uhm... functions, you
define them in a module file. The module file is the package. Is that what is
going on for the Java APIs? Is it just a choice of which functions to put in
which box and which box to put in a package?
Are Java classes all
about object organisation and not about object creation?
Don't go to
any trouble to reply: I'm not that fussed. I'm sticking to my box of frogs and a
big snake.--- Regards
Ian Al
Software Patents: It's the disclosed functions in the patent, stupid! [ Reply to This | Parent | # ]
|
|
|
|
|