Solved

Does Flex have Abstract class

Posted on 2010-11-20
4
1,313 Views
Last Modified: 2012-05-10
Does Flex have abstract class ?If so please can some one give an example
0
Comment
Question by:randyraj
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
mawni earned 250 total points
ID: 34183059
as far as I know, Flex (Action Script) doesn't support abstract classes!
0
 
LVL 14

Assisted Solution

by:tomaugerdotcom
tomaugerdotcom earned 250 total points
ID: 34220476
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
 

Author Closing Comment

by:randyraj
ID: 34476156
Thanks
0
 
LVL 14

Expert Comment

by:tomaugerdotcom
ID: 34476291
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Flex automation silktest 3 924
flex - list item renderer 7 684
Adobe license 6 276
adobe air 1 303
First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
The advancement in technology has been a great source of betterment and empowerment for the human race, Nevertheless, this is not to say that technology doesn’t have any problems. We are bombarded with constant distractions, whether as an overload o…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question