Sign in to follow this  
thedodgeruk

is three any way to do this?

Recommended Posts

thedodgeruk    124
sway you create a class, on top of a base class called , CEntity, and the clhild class is call Player.


is there a way you could do

CEntity* CreateInstance (CEntity temp);



via

CreateEntity(Player);

Share this post


Link to post
Share on other sites
VildNinja    789
If Player extends CEntity, Player can act as a CEntity type. CEntity can however not act as a Player type.

So if your method takes a CEntity type as an argument, then yes you can give it a Player type without any problems. Just remember that you can only access the methods on the Player type it has inherited from CEntity, not any new methods you've created in the player class.

Share this post


Link to post
Share on other sites
Telastyn    3777
[quote name='thedodgeruk' timestamp='1306709229' post='4817266']
sway you create a class, on top of a base class called , CEntity, and the clhild class is call Player.


is there a way you could do

CEntity* CreateInstance (CEntity temp);



via

CreateEntity(Player);
[/quote]

In what language?

In general, that's a fairly odd way to do it. Usually you'll see a clone method that copies the existing instance or some string/identifier to create a new specific instance from nothing.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this