# Getting a variable from a class

**URL:** <https://forum.kirupa.com/t/getting-a-variable-from-a-class/238300>\
**Category:** Uncategorized\
**Created:** [September 9, 2007, 4:20pm UTC](https://forum.kirupa.com/t/getting-a-variable-from-a-class/238300 "2007-09-09T16:20:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![elyleebert](https://avatars.discourse-cdn.com/v4/letter/e/e56c9b/32.png) [@elyleebert](https://forum.kirupa.com/u/elyleebert)\
**Post date:** [September 9, 2007, 4:20pm UTC](https://forum.kirupa.com/t/getting-a-variable-from-a-class/238300/1 "2007-09-09T16:20:31Z")

</div>

I have just created a class ‘ClassA’ that loads an XML file.Within that class I have a public function that navigates through the XML and populates arrays with the XML content.

I am now creating another class, which will be called ‘ClassB’ which I plan to extend ‘ClassA’.

\>From ‘ClassB’ I would like to reference the array variable (which is not in the constructor) to re-use in the ‘ClassB’ class. I have tried tons of different ways all of which I get undefined.

Could anyone help?

Cheers
