Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cast conversion from Object* to int

Status
Not open for further replies.

Wolfie7873

Technical User
Jan 15, 2004
94
0
0
US
So I learned today that VC++.NET doesn't like to do an on-the-fly cast conversion. I'm hoping for a workaround.

I have an ArrayList object that contains integers only, and I want to get an item, and process the integer with a switch:

Code:
__property void set_MSCheckList(ArrayList* myList) {

   for (int i=0; i< myList->Count; i++) {
      switch(myList->get_Item(i)) {
         case 1: {
         // do something with '1'
         }
         //etc.
      }
   }
}

Now, the compiler tells me that it doesn't want to convert the virtual object type to an int that the switch statement can play with. So, how do I actually use the return of the get_Item() method?

Thanks in advance.
Eddie
 
What's an ArrayList?
What type does the get_Item() function return?
If it returns some type of object, see if that object has a function that can return an int...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top