Way to stop a class from extending another one?

Discussion in 'Plugin Development' started by JPG2000, Oct 27, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    JPG2000

    While creating a resource, I came upon a little issue: Is there away to stop a class from extending another class?

    So basicly, lets say I have a class named Apples. Is there away for someone else, who has a class, lets say named "Main", from extending Apples? Perferrable without "private class Apples".

    Thanks!
     
  2. Offline

    Tirelessly

    Make the class final, as such:

    public final class Apples
     
    1Rogue likes this.
  3. Offline

    JPG2000

    Tirelessly Ah. Would it effect creating objects, variables etc?
     
  4. Offline

    adam753

    Yes, you make the class final.
    Code:
    public final class Apples {
    Edit: Wow you guys are fast.
     
    JPG2000 likes this.
  5. Offline

    Tirelessly

    Nope, it'd just make it not extendable.

    EDIT: Well, nothing that you would notice.
     
    JPG2000 likes this.
  6. Offline

    JPG2000

Thread Status:
Not open for further replies.

Share This Page