You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2021/12/16 14:57:03 UTC

[royale-docs] 02/03: Added some content to classes and functions

This is an automated email from the ASF dual-hosted git repository.

harbs pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/royale-docs.git

commit a8dab150fc26a6989f9cc588f169c87b926d1d22
Author: Harbs <ha...@in-tools.com>
AuthorDate: Thu Dec 16 16:56:12 2021 +0200

    Added some content to classes and functions
---
 features/as3/classes-and-functions.md | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/features/as3/classes-and-functions.md b/features/as3/classes-and-functions.md
index fdc6f85..e53fb32 100644
--- a/features/as3/classes-and-functions.md
+++ b/features/as3/classes-and-functions.md
@@ -23,3 +23,30 @@ permalink: /features/as3/classes-and-functions
 # Classes and Functions
 
 Classes and functions in ActionScript 3
+
+## File Structure
+As mentioned in [packages](features/as3/packages), each file in ActionScript needs a `package` declaration. Similarly, there must be exactly one file for each externally visible Class (or function). Additionally, the class name must match the class name exactly. By convention, class names start with an uppercase character.
+
+## Inheritance and interfaces
+ActionScript classes can only inherit from a single `super` class, but you can declare multiple interfaces. So if you need a class to be more than one unrelated types, you should use interfaces to declare your types rather than classes. Sub-classing and declaring interfaces looks like this:
+
+```
+public class SubClass extends SuperClass implements IFoo, IBaz, IBar
+```
+
+## Constructors
+Constructors in ActionScript are optional. If you need to initialize something in your class you should always declare a constructor and you can define at which point the `super` class is instantiated by calling `super()` inside the constructor. Subclasses and super-classes do not need to have the same number of arguments so the following is perfectly valid:
+
+```
+package{
+	public class SubClass(){
+		foo = "foo";
+		super("baz")
+	}
+	private var foo:String
+}
+```
+
+## Static accessors
+By default
+## Using `this`