# Noob OOP class question

**URL:** <https://forum.kirupa.com/t/noob-oop-class-question/313701>\
**Category:** flash\
**Created:** [September 7, 2010, 4:44pm UTC](https://forum.kirupa.com/t/noob-oop-class-question/313701 "2010-09-07T16:44:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esseti](https://avatars.discourse-cdn.com/v4/letter/e/bb73d2/32.png) [@Esseti](https://forum.kirupa.com/u/Esseti)\
**Post date:** [September 7, 2010, 4:44pm UTC](https://forum.kirupa.com/t/noob-oop-class-question/313701/1 "2010-09-07T16:44:35Z")

</div>

I’m switching to full OOP programming since I have nothing else to do other than to learn the same language again. Anyway I’ve got a question about accessing public vars in a subclass:

Test.as

```auto

package
{
	import flash.display.Sprite;
	import SubTest;
	public class Test extends Sprite
	{
		public var _sW:uint;
		public var subTest:SubTest;
		public function Test() 
		{
			subTest = new SubTest();
			trace("This is the Test class", sW); // returns stageWidth normally;
		}
		public function get sW():uint {
			_sW = stage.stageWidth;
			return _sW;
		}
	}

}

```

SubTest.as

```auto

package
{
	public class SubTest
	{
		public function SubTest()
		{
			trace("This is the SubTest class", sW); // I get an unknown variable sW;
		}
		
	}

}

```

Why can’t I call the get sW method from the Test.class since it is public method and resides within the same package?
