Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 341935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:45:19+00:00 2026-05-12T10:45:19+00:00

I am overriding the addItem() function of an array collection and I would like

  • 0

I am overriding the addItem() function of an array collection and I would like to detect if the added item implements a particular interface.

Previously I used the, is operator to detect the class type, but now that I am using an interface for classes I would rather test to see if the object implements the interface.

I expect I could just try and cast the object as the interface and see if it’s not null. Is this the best way to do it?

I could also just create a new addFunction() that only accepts objects of the interface type.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T10:45:20+00:00Added an answer on May 12, 2026 at 10:45 am

    You can still use is to test for an interface.

    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768" creationComplete="application1_creationCompleteHandler(event)">
        <fx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
                public var test:TestInterface = new TestInterface() //implements ITestInterface
    
    
                protected function application1_creationCompleteHandler(event:FlexEvent):void
                {
                    trace(test is ITestInterface); //true
                }
    
            ]]>
        </fx:Script>
    </s:Application>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm overriding a property in my derived class that I would like to make
When overriding the equals() function of java.lang.Object, the javadocs suggest that, it is generally
I'm overriding WndProc, so I want to write code like if (m.Msg == WM_COMMAND)
In my project i used this below function public function createIconMenu():NativeMenu{ var iconMenu:NativeMenu =
Possible Duplicates: Overriding vs Virtual How am i overriding this C++ inherited member function
Message is 1024: Overriding a function that is not marked for override. what does
When overriding the MembershipProvider and calling it directly, is there a way to fill
I am overriding a Grid, adding some customer features. One of the features is
I was wondering whether overriding conversion operators is only applicable to numeric types? If
What issues / pitfalls must be considered when overriding equals and hashCode ?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.