Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1340
  • Last Modified:

Does Flex have Abstract class

Does Flex have abstract class ?If so please can some one give an example
0
randyraj
Asked:
randyraj
  • 2
2 Solutions
 
mawniCommented:
as far as I know, Flex (Action Script) doesn't support abstract classes!
0
 
tomaugerdotcomCommented:
AS3 does not support abstract classes directly (ie: there is no "Abstract" directive).

However, an abstract class is essentially a class for whose methods you do not define an implementation. The best practice around abstract class creation can be summed up in this example:
package {
  public class MyAbstractClass implements IMyClass {
    public function MyAbstractClass() {

    }

    public function myPublicMethod():Object {
      throw new Error("Abstract Class: you must define an implementation for myPublicMethod");
      return new Object(); // so we don't get a compile-time error
    }

    private function myPrivateMethod():String {
       throw new Error("Abstract Class: you must define an implementation for myPrivateMethod");
       return ""; / to avoid compile-time exception
    }
  }
}

Open in new window

0
 
randyrajAuthor Commented:
Thanks
0
 
tomaugerdotcomCommented:
I don't normally complain, but how is my answer a "C"? It's complete, it has a working code example and it addresses your question explicitly. What is your expectation of an "A" answer?
0

Featured Post

Sign your company up to try the MB 660 headset now

Take control and stay focused in noisy open office environments with the MB 660. By reducing background noise, you can revitalize your office and improve concentration.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now