is Python fully object oriented ?
Rainer Deyke
root at rainerdeyke.com
Fri Jan 12 18:59:43 EST 2001
"David C. Ullrich" <ullrich at math.okstate.edu> wrote in message
news:93nifo$qa7$1 at nnrp1.deja.com...
> A person could invent syntax to do exactly that one thing
> with an implicit self, maybe with an "inherited" keyword
> as in the one language I know with an implicit self (Object
> Pascal). How would a person do
>
> class C(A, B):
> def __init__(self):
> A.__init__(self)
> B.__init__(self)
>
> with an implicit self?
The following is valid C++:
struct A {
A() {} // empty constructor, no arguments
};
struct B {
B() {} // same
};
struct C : A, B {
C() : A(), B() {} // explictly calls both base constructors
};
Incidentially, all three of the above constructors would have been
automatically generated by the compiler were they not explictly declared.
Whether this is a Good Thing or a Bad Thing depends on your perspective.
A better example might be a non-constructor function:
struct A {
void f() {}
};
struct B {
void f() {}
};
struct C : A, B {
void f() { A::f(); B::f(); }
};
--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games - http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
More information about the Python-list
mailing list