Re: Mutability
Re: Mutability
- Subject: Re: Mutability
- From: Raphael Sebbe <email@hidden>
- Date: Wed, 21 Nov 2001 18:06:07 +0100
Ondra,
I am not sure what you mean here, but one of the points of the OO
approach, when compared to the procedural one, is to get rid of the
"switch" and "if else if" sequences. This is accomplished because
objects know how to handle a particular situation :
Procedural:
drawShape(shape)
{
switch(shape->id)
{
case CIRCLE:
drawCircle(shape);
case RECTANGLE:
drawRectangle(shape);
}
}
OO:
[shape draw];
At least, you demonstrated that it is possible to do procedural
programming with Obj-C. And, although I prefer Obj-C over C++, I can
assure you that OO programming is possible using C++.
Raphael
On Wednesday, November 21, 2001, at 02:57 PM, Ondra Cada wrote:
I beg to differ. It seems to me that the proper OO approach is "give
any id
to me; I'll ask it what kind it is, and I'll behave accordingly".
The approach you advocate here -- ie. "give me an object we both know
beforehand which kind it is" seems to me like non-object-oriented,
C++-way of
thinking.