void pointer syntax

Era Scarecrow rtcvb32 at yahoo.com
Wed May 16 04:37:24 PDT 2012


On Wednesday, 16 May 2012 at 11:12:19 UTC, Stephen Jones wrote:
> Ali your post above, and T your post in the other forum 
> (Simpsons bit) is sort of what I was after. I tried both 
> interface and abstract class but not outright super class. The 
> problem I have with the solution is the same problem I have 
> with header files and cpp files; in both instances you need to 
> hunt in other files for the variable's definition. If name is a 
> field that will contain Bart's name then it should be in the 
> Bart class, otherwise I end up wasting time confused about some 
> variable that has been initialized or used to initialize some 
> other variable and not finding it in the relevant module.

  But the thing about using an abstract class, and 
polymorphism/inheritance is the known interface is whatever the 
object is cast to. So the Simpson family
  you only know about string name, and object; That meaning 
anything that bart may have otherwise isn't accessible since that 
part of the code doesn't know more than what the Simpson class 
lets it know ahead of time. That is it. There isn't that much to 
look up depending on how high up/down you go. But I do hate 
looking up the information too..

> Cain: My understanding is that D is based on "no proper ways of 
> doing things" just get the job done.

  I thought that was C++.... it was something like 'refuse to give 
in to an ounce of better control or simplicity if it may have any 
impact on performance and zero overhead'.... plus backwards 
compatibility. Besides the STL is so confusing I will likely 
never use it or most of C++.

  Proper ways of doing things are more how you write your code 
rather than the language. immutable, string, shared, scope... All 
these things have a 'proper way' of using them if you look. Just 
having an array as a fat pointer (with length) is a huge 
improvement that's built into the language. It's almost more 'D 
is so new that the proper way to make use of it isn't fully 
written/available'.


More information about the Digitalmars-d-learn mailing list