# When to extend a class vs use a property?

**URL:** <https://forum.kirupa.com/t/when-to-extend-a-class-vs-use-a-property/299963>\
**Category:** flash\
**Created:** [November 13, 2009, 2:17pm UTC](https://forum.kirupa.com/t/when-to-extend-a-class-vs-use-a-property/299963 "2009-11-13T14:17:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![contrast](https://avatars.discourse-cdn.com/v4/letter/c/f05b48/32.png) [@contrast](https://forum.kirupa.com/u/contrast)\
**Post date:** [November 13, 2009, 2:17pm UTC](https://forum.kirupa.com/t/when-to-extend-a-class-vs-use-a-property/299963/1 "2009-11-13T14:17:28Z")

</div>

I am creating a custom class “CardboardBox”. This extends Cube from the Away3D library, this allows me to give it an x, y, z values, and utilize all of the Cube functions.

But I also want to use bindable variables in my class (no flex here, just AS3), so I found Bumpslide:

[http://bumpslide.com/blog/2009/03/04/data-binding-for-flash/](http://bumpslide.com/blog/2009/03/04/data-binding-for-flash/)

The only issue I have is that to make my class have bindable variables, it needs to extend BindableModel. Since it already extends Cube, the only solution I can see to this is to have my CardboardBox class have a property of cube. So to access the x value of myCardboardBox, I would have to write:

myCardboardBox.cube.x

This seems cluttered and like there should be a better way. Am I missing a step to have a clean MVC approach to this? Should the data for the CardboardBox be separate from the visual representation of it, the Cube? Or should I stick with using a cube property inside my class?

Thanks for any help on this.
