Jump to content
  • Advertisement
Sign in to follow this  
thedodgeruk

is three any way to do this?

This topic is 2610 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
Advertisement
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

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);


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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!