Re: Lahman, how ya doing?
- From: glhansen@xxxxxxxxxxxxxxxxxxxxx (Gregory L. Hansen)
- Date: Fri, 20 May 2005 02:08:14 +0000 (UTC)
In article <bv6je.8995$_f7.1506@trndny01>,
H. S. Lahman <hsl@xxxxxxxxxxxxxxxxx> wrote:
>Responding to Hansen...
>
>> So it's not just me! I've been starting to notice that C++ seems to make
>> it harder than it has to be to do things that must be common in OOP.
>
>C++ is generally regarded as the most technically deficient of the
>popular OOPLs. A major reason was the that performance and low-level
>machine control were primary design objective. That results in a lot of
>compromises. Given the design goal, it is not bad. However, the prices
>one pays are that a higher skill is required to use it properly and
>there are a lot more opportunities for foot-shooting.
>
>
>> It
>> didn't take me long to realize that a generic pointer can only hold any
>> variety of classes if they were all derived from a single base class
>> (e.g. the recipient of an event, or the object to read data from), but
>> you can't invoke methods unique to a derived class with a pointer to the
>> base class. I suppose there's dynamic typecasting techniques to get
>> around that, but it just seemed easier to let my base class keep
>> accumulating virtual member functions as derived classes gained their own
>> functions.
>
>Actually C++ provides dynamic_cast for this. It exists as a mechanism
>to deal with an external stream of arbitrary objects where one needs to
>determine the nature of the object in hand to access its specializations.
I played with dynamic_cast a little and didn't really seem to get the
results that I wanted. And every single pointer would have a dynamic_cast
next to it, anyway. So I just went with the dullard's approach.
As I've been working on this problem I quickly started flipping through
pages at the back of my C++ text, making immediate use of some of the more
advanced concepts. It was an information blitz, a bit overwhelming, so
I've been trying to keep it a little simpler where I could.
>
>However, I regard that as one of C++'s deficiencies because too many
>people abuse it to navigate from superclass to subclass during routine
>collaborations. Subclassing relationships are not navigable for
>collaboration because there is only one instance in hand to navigate.
>
>If one needs to access the subclass specializations (and the object is
>not supplied externally), then there should already be a direct
>relationship path to the subclass that can be navigated. That path will
>provide type safety and whatnot. If that relationship is not properly
>implemented and instantiated, then that is a design fault.
I'll pick up one of the more OOPy languages eventually. But for now I'll
just stick with C++, that's what I know.
By the way, what do you think of exceptions. Some people really like
them. I get a little confused.
--
"Not that there's anything wrong with just lying around on your back. In
its way, rotting is interesing too... It's just that there are other ways
to spend your time as a cadaver." -- Mary Roach, "Stiff", 2003.
.
- Follow-Ups:
- Re: Lahman, how ya doing?
- From: H. S. Lahman
- Re: Lahman, how ya doing?
- References:
- Re: Lahman, how ya doing?
- From: H. S. Lahman
- Re: Lahman, how ya doing?
- From: Gregory L. Hansen
- Re: Lahman, how ya doing?
- From: H. S. Lahman
- Re: Lahman, how ya doing?
- Prev by Date: Re: Lahman, how ya doing?
- Next by Date: Re: Class Design Question
- Previous by thread: Re: Lahman, how ya doing?
- Next by thread: Re: Lahman, how ya doing?
- Index(es):
Relevant Pages
|