Sign in to follow this  

is three any way to do this?

This topic is 2393 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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
[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

This topic is 2393 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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