[comp.lang.c++] My stupid mistake earlier and another question

sorrow@oak.circa.ufl.edu (06/20/91)

Well now, my introduction to this group has not been the most noble or
impressive yet...phew, three posts and three flames.  Gads, and I thought
I would learn something EASILY.  Feh! :-)

Anyway, I received hell for this:

char *Something=malloc(100);
char  SomethingElse[]=Something;

While it is now apparent that it won't work, my slightly deranged reasoning
was that this would work:

char SomethingElse[]="Hello world!";

And I figured the const char * would be the same as the dynamically allocated
pointer above.  Oops.  Sorry about that.

On to the rest of the show, about the game and determining object types.  
Everyone replied that I should use virtual functions.  This is conceptually
valid (much like the whole language) but implementation is proving to be
a tad difficult (I'm new to the language, in case you didn't guess.)

The problem: OBJECTs can do different things, and what they do could
greatly affect their surroundings.  Example, if an object is throw, it could
do something to the surroudnings, the character, what it was thrown at,
etc.  What is the correct way of informing the affected entity that it has
in fact been or should be modified?  Global variables?  I think not.  And
I can't rightly prototype all the functions, since what an object can and
should and may affect can't be determined at run time, and I sure don't think
tons and tons of virtual/overloaded functios would make sense.  Then again,
who knows.  

Brian
/*
Brian Hook -- MS-DOS Programmer for Contract
-----------------------------------------------------------------
"Seamus, that's my dog...I saw her today at the reception...sorry, sixTEEN
inches....better save the women and children first...but this one goes to 11!
..anymore of that plutonium nyborg?....there can be only ONE!....like a 
finger pointing to the moon....ease the seat back...one day closer to death
*/