A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Virtual keyword

  1. #1
    The Cheeze to Your Macaroni ColbyCheeze's Avatar
    Join Date
    Dec 2007
    Location
    Texas
    Posts
    244

    Virtual keyword

    Having trouble seeing what the difference between putting the virtual keyword in a function and not having it all is.

    Anybody have an example of how putting the virtual keyword would change the behavior of something?

  2. #2
    Senior Member UnknownGuy's Avatar
    Join Date
    Jul 2003
    Location
    Canada
    Posts
    1,361
    I just looked and found this(hadn't heard of use of the keyword virtual before for ActionsScript): http://stackoverflow.com/questions/3...erformance-hit

    So it apparently doesn't matter at the moment.

    UnknownGuy

  3. #3
    The Cheeze to Your Macaroni ColbyCheeze's Avatar
    Join Date
    Dec 2007
    Location
    Texas
    Posts
    244
    Oh alright...thanks that cleared that up. It was starting to bug me, because I've seen it used several times in other people's code. I assume they are just used to using it in C++ so they probably figured they had to use it here.

  4. #4
    Senior Member ninjakannon's Avatar
    Join Date
    Sep 2004
    Posts
    393
    I use the virtual keyword to make it clear which methods I intend to or have overridden. I know that there's no difference to the compiled code, but it's nice to make it really clear.

    Just pointing out that there are reasons other than ignorance for using the reserved keywords.
    ninjakannon

    - My Website -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center