# Extending classes

**URL:** https://discourse.processing.org/t/extending-classes/21973
**Category:** Beginners
**Created:** [June 18, 2020, 2:19am UTC](https://discourse.processing.org/t/extending-classes/21973 "2020-06-18T02:19:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![FurryNightShade](https://avatars.discourse-cdn.com/v4/letter/f/e5b9ba/32.png) [@FurryNightShade](https://discourse.processing.org/u/FurryNightShade)
#### Post date: [June 18, 2020, 2:19am UTC](https://discourse.processing.org/t/extending-classes/21973/1 "2020-06-18T02:19:31Z")

</div>

So, let’s say, I have classes ExternalClass, OutterClass and InnerClass in a sketch called TestProject:

```auto
public class ExternalClass{
  ExternalClass(){
    
  }
}

final static public class OutterClass{
  final static public class InnerClass extends ExternalClass{
    private String someValue;
    InnerClass(String someValue){
      super();
      this.someValue = someValue;
    }
  }
}

```

The console shows an error:

> TestProject [11]: No enclosing instance of type TestProject is available due to some intermediate constructor invocation

What’s going on and how do I extend InnerClass by ExternalClass?

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [June 18, 2020, 3:05am UTC](https://discourse.processing.org/t/extending-classes/21973/3 "2020-06-18T03:05:54Z")

</div>

- All classes & interfaces inside “.pde” files are nested within the sketch’s PApplet subclass.
- And if they aren’t declared w/ the keyword `static`, they’re also called inner classes.
- That means your class ExternalClass is actually an inner class.
- And b/c it’s declared w/ `static`, OuterClass isn’t an inner class, but just a nested class, enclosed within a PApplet subclass.
- For the same reason, InnerClass isn’t an inner class, but the OuterClass’s nested class.
- As a workaround you can turn ExternalClass inner class to a nested 1 by declaring it w/ `static`.
