Discussion Board
Go to the previous messageGo to the following message
Current Forum: Homework 3 Forum
Date: Fri Sep 28 2001 10:49 pm
Author: Lee, Charles C. <chucklee@cmu.edu>
Subject: Re: Casting int to Object

1. If you want to add an element of type int into a vector, just use one of the methods. Casting the int into an object is not necessary when you are sending the integer type variable in as a argument for the add method.
BUT DO NOTE:
2. If the method you are using RETURNS something of type OBJECT, for example, elementAt(int ), you need to cast the OBJECT into int, assuming you want it the elementAt(int) to return an int.(or whatever type you want)
Post response

Go to the previous messageGo to the following message
Current Thread Detail:
Casting int to Object      Zaman, Rashid      Fri Sep 28 2001 7:44 pm       
Re: Casting int to Object      Lee, Charles C.      Fri Sep 28 2001 10:49 pm       
Re: Casting int to Object      Fagan, Matthew T.      Sun Sep 30 2001 12:41 am       
Re: Casting int to Object      Liu, Limin Angela      Sun Sep 30 2001 3:08 am       

Back to previous screen