# Classes and subclases

**URL:** <https://discourse.processing.org/t/classes-and-subclases/41583>\
**Category:** Coding Questions\
**Created:** [April 3, 2023, 2:56pm UTC](https://discourse.processing.org/t/classes-and-subclases/41583 "2023-04-03T14:56:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![carl\_extends\_code](https://avatars.discourse-cdn.com/v4/letter/c/ecc23a/32.png) [@carl\_extends\_code](https://discourse.processing.org/u/carl_extends_code)\
**Post date:** [April 3, 2023, 2:56pm UTC](https://discourse.processing.org/t/classes-and-subclases/41583/1 "2023-04-03T14:56:24Z")

</div>

Hi,  
Im working on a smal game and I have different enemies. They all have the same amount of animation frames and therfore I thought that there was a possibility to use an Animation class and let all the monsters extend it, so that I only have to write the code once.  
I mean something like this:

```auto
class A{
A(){

}

void loadFrames(){

}
void updateAnimation(){

}
}

class EnimyA{
//In here give file names and frame count ezt to do the stuff from A
}
class EnimyB{
//In here give file names and frame count ezt to do the stuff from A
}

```

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [April 3, 2023, 3:29pm UTC](https://discourse.processing.org/t/classes-and-subclases/41583/2 "2023-04-03T15:29:50Z")

</div>

Check here [extends / Reference / Processing.org](https://processing.org/reference/extends.html)

---

<div class="post-metadata">

**Author:** ![carl\_extends\_code](https://avatars.discourse-cdn.com/v4/letter/c/ecc23a/32.png) [@carl\_extends\_code](https://discourse.processing.org/u/carl_extends_code)\
**Post date:** [April 3, 2023, 3:53pm UTC](https://discourse.processing.org/t/classes-and-subclases/41583/3 "2023-04-03T15:53:17Z")

</div>

Thank you, That helped 😃
