Skip navigation
Currently Being Moderated

Conflicting instance names (that are both of the interface type used in the Class definition)

Jun 15, 2012 6:16 AM

Tags: #actionscript3 #interface #warning

Hi, all;

 

I have a Class that has a radio button question in Frame 1 and a check box question in Frame 2. This is so that we can dynamically show the right question type based on the data. To enable this, both of these question views implement IQuestionView, and I just use goToAndStop to select the right one. When the setter is triggered by the player's populating the instance, I inject the View with the Question data and remove the listeners from the previous instance.

 

My issue is that I am getting a warning:

 

Warning: The instance name 'questionView' is declared on an object of type SingleSelectQuestionClip but there is a conflicting use of the instance name 'questionView' on an object of type MultiSelectQuestionClip.

 

It occurs to me that I could probably fix this by simply changing the type from IQuestionView to BaseQuestionView (which they both extend), but I don't want to do that because not every IQuestionView in the project is a BaseQuestionView. I'd rather not introduce inconsistency just to avoid a compiler warning, but by the same token I don't want to force the whole team to deal with a compiler warning either.

 

Is there another option?

 
Replies
  • kglad
    72,189 posts
    Jul 21, 2002
    Currently Being Moderated
    Jun 15, 2012 6:28 AM   in reply to Amy Blankenship

    you should be able to cast questionView as the QuestionClip type that you want and that will make the compiler happy.

     
    |
    Mark as:
  • kglad
    72,189 posts
    Jul 21, 2002
    Currently Being Moderated
    Jun 15, 2012 11:22 AM   in reply to Amy Blankenship

    i don't see anything there that's a SingleSelectQuestionClip/MultiSelectQuestionClip instance.

     

    what's IQuestionView extend, subclass and/or implement?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points