# Subclass addChild issues

**URL:** <https://forum.kirupa.com/t/subclass-addchild-issues/328559>\
**Category:** Uncategorized\
**Created:** [May 25, 2012, 10:01pm UTC](https://forum.kirupa.com/t/subclass-addchild-issues/328559 "2012-05-25T22:01:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![activa](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@activa](https://forum.kirupa.com/u/activa)\
**Post date:** [May 25, 2012, 10:01pm UTC](https://forum.kirupa.com/t/subclass-addchild-issues/328559/1 "2012-05-25T22:01:17Z")

</div>

Ok, I have a class, let’s call it SuperClass, and a subclass, let’s call it SubClass that extends SuperClass. SuperClass has a protected method that adds a child to the instance of SubClass.

Thit method gets called when SubClass is instantiated (through the “super()” call) or later directly from a SubClass instance.

I would have thought that in both cases, the child that is added is a child of the SubClass instance (since technically the superclass is only instantiated as the subclass). However, I get different results when I trace out the parent hierarchy for the added child.

Why is this, and how do I ensure that the child that is added is added to the subclass instance?
