Click here to Skip to main content
15,929,841 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Build Configurations Pin
David Crow19-Apr-04 5:13
David Crow19-Apr-04 5:13 
GeneralRe: Build Configurations Pin
Demian Panello19-Apr-04 5:25
Demian Panello19-Apr-04 5:25 
GeneralRe: Build Configurations Pin
David Crow19-Apr-04 5:29
David Crow19-Apr-04 5:29 
GeneralRe: Build Configurations Pin
Demian Panello19-Apr-04 5:41
Demian Panello19-Apr-04 5:41 
Generalerror message Pin
icem4n19-Apr-04 4:37
icem4n19-Apr-04 4:37 
GeneralRe: error message Pin
Navin19-Apr-04 5:42
Navin19-Apr-04 5:42 
GeneralExtending the WAB Context Menu Actions Source Code Pin
Pyramid119-Apr-04 4:36
Pyramid119-Apr-04 4:36 
Generaltypeid operator Pin
kfaday19-Apr-04 4:28
kfaday19-Apr-04 4:28 
Hello

I've got a vehicle class (cVehicle), and two 'heirs', car (cCar)and van (cVan). I store cars and vans in a list. The cvehicle class has a vehicle_type atribute (a char that is 'c' when it's a car and 'v' if it's a van). I want to take it out.

in the following code, i get a vehicle from a list. I don;t know if it's a car or it's a van. I use the vehicle_type atribute to see if it's a car, and if it is, i must return it.

<br />
		cvehicle *vtemp=(list->Getvehicle());<br />
		if (vtemp->get_vehicle_type()=='c')<br />
  	 	 				return vtemp;<br />
<br />


i've heard of a more elegant way to solve it, that is with the typeid operator. Do you know how to use it?

thanks!
GeneralRe: typeid operator Pin
toxcct19-Apr-04 4:33
toxcct19-Apr-04 4:33 
GeneralRe: typeid operator Pin
kfaday19-Apr-04 4:38
kfaday19-Apr-04 4:38 
GeneralRe: typeid operator Pin
jmkhael19-Apr-04 5:09
jmkhael19-Apr-04 5:09 
GeneralRe: typeid operator Pin
kfaday19-Apr-04 5:46
kfaday19-Apr-04 5:46 
GeneralRe: typeid operator Pin
jmkhael19-Apr-04 5:58
jmkhael19-Apr-04 5:58 
GeneralRe: typeid operator Pin
kfaday19-Apr-04 6:53
kfaday19-Apr-04 6:53 
GeneralRe: typeid operator Pin
jmkhael19-Apr-04 6:56
jmkhael19-Apr-04 6:56 
GeneralRe: typeid operator Pin
kfaday19-Apr-04 7:01
kfaday19-Apr-04 7:01 
GeneralRe: typeid operator Pin
jmkhael19-Apr-04 7:03
jmkhael19-Apr-04 7:03 
GeneralRe: typeid operator Pin
kfaday19-Apr-04 7:07
kfaday19-Apr-04 7:07 
GeneralRe: typeid operator Pin
jmkhael19-Apr-04 7:14
jmkhael19-Apr-04 7:14 
GeneralRe: typeid operator Pin
kfaday19-Apr-04 7:48
kfaday19-Apr-04 7:48 
GeneralRe: typeid operator Pin
antlers19-Apr-04 12:04
antlers19-Apr-04 12:04 
GeneralRe: typeid operator Pin
kfaday19-Apr-04 13:35
kfaday19-Apr-04 13:35 
GeneralRe: typeid operator Pin
toxcct19-Apr-04 8:31
toxcct19-Apr-04 8:31 
GeneralResponding to messages raised by another process Pin
Member 103146319-Apr-04 3:51
Member 103146319-Apr-04 3:51 
GeneralRe: Responding to messages raised by another process Pin
toxcct19-Apr-04 4:14
toxcct19-Apr-04 4:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.