Im writing a really simple class that is to be the foundation of an adventuregame in D3D... Just for me to learn DirectX

Anyway I have defined an abstract baseclass "Entity" which can represent any given object in the world, rock, bridge, weapon etc.

In this baseclass I have an abstract sub called "WhenSpellCasted" which has these parameters

Spell as CSpell <-- the spell casted

Strength as double <--how strong the spell was (depending on the magic capabilities of the caster

Naturally I want any item to respond one way or another to a spell, perhaps reveal hidden items, or nothing happens...

Then I create an object CMan : inherits Entity
This class has lots of properties that a man has... and I also implement then sub "WhenSpellCasted" that looks kinda like this

VB Code:
  1. public sub WhenSpellcasted(byval spell as cspell, byval strength as double)
  2.  
  3. 'The spell object affects the attributes of the object it was cast on
  4. spell.applymagic(Me,strength)
  5.  
  6. end sub


Now here is the problem:

I define a class of magician

VB Code:
  1. public class CMagician : inherits Entity
  2. private m_Mana as double = 0
  3.  
  4. ppublic Sub CastSpell(byval target as Entity, byval strength as double)
  5.  
  6. target.WhenSpellCasted(myfirespell,10)

Here I get an error saying that the entity object can't be implicitly converted to a CMan object...

Why is that? The whole point of using base classes if for the purpose Im using it as...?



Kidn regards
Henrik