Does Flex have Abstract class

Does Flex have abstract class ?If so please can some one give an example
randyrajAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
mawniConnect With a Mentor Commented:
as far as I know, Flex (Action Script) doesn't support abstract classes!
0
 
tomaugerdotcomConnect With a Mentor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.