# Modifing functions in classes using extends

**URL:** <https://discourse.processing.org/t/modifing-functions-in-classes-using-extends/11913>\
**Category:** Coding Questions\
**Created:** [June 8, 2019, 1:40am UTC](https://discourse.processing.org/t/modifing-functions-in-classes-using-extends/11913 "2019-06-08T01:40:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![skyjoe66](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@skyjoe66](https://discourse.processing.org/u/skyjoe66)\
**Post date:** [June 8, 2019, 1:40am UTC](https://discourse.processing.org/t/modifing-functions-in-classes-using-extends/11913/1 "2019-06-08T01:40:35Z")

</div>

i am making a game and am using nested classes to create block variations, but i want tree to have an addition to the drawing process (a progress bar). is there a way to use the same function call but have it run like normal and then draw a rectangle.

```auto
class tile{
  int x,y;String sprite;
  tile(int ix,int iy,String is){x=ix;y=iy;sprite=is;}
  void render(){
    drawSprite(sprite,x*32,y*32);
    text(x,x*32,y*32);
  }
}
class grass extends tile{
  grass(int ix,int iy){super(ix,iy,"image1");}
  
}class tree extends tile{
  tree(int ix,int iy){super(ix,iy,"image0");}
  void render(){
    //runTileRender
    fill(255,255,0);
    rect(x,y+32,32,-4);
  }
}

```

---

<div class="post-metadata">

**Author:** ![skyjoe66](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@skyjoe66](https://discourse.processing.org/u/skyjoe66)\
**Post date:** [June 8, 2019, 1:51am UTC](https://discourse.processing.org/t/modifing-functions-in-classes-using-extends/11913/2 "2019-06-08T01:51:20Z")

</div>

I figured it out, its

```auto
super.render();

```

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [June 9, 2019, 11:05pm UTC](https://discourse.processing.org/t/modifing-functions-in-classes-using-extends/11913/3 "2019-06-09T23:05:27Z")

</div>

Great!

Another option if things get more complex later is composition, using implements. Then some things can be Renderable and some things can be Progressable.
