简体   繁体   中英

Javascript functions and child/parent inheritance

Im not sure if this is an allowed question but i beleive it comes under 'software tools commonly used by programmers; and is a practical, answerable problem that is unique to software development'. So would someone be able to explain to me how the child and parent prototypes work in javascript preferrably with an example for implementatipon or code example. Speciffically:

  1. How to layout parent constructors and methods

  2. How to layout child constructors and methods

  3. How to link a child method to a parent method

  4. How to reference the parent method from the child method

  5. What would be a practical implementation of this.

    I was thinking of creating a powerup class for my game and then creating Child classes for say a forcefeild, a speed booster ect

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM