LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-06-2001, 08:14 PM   #1
bretthoward
Member
 
Registered: Mar 2001
Location: Klamath Falls
Posts: 62

Rep: Reputation: 15

I if someone could explain to me what all of the C++ casts are mainly used for such as which one is used for going up and down a tree (dynamic is for down and static is for up?) I am working on a very simple project which can be viewed at this address:

http://www.cset.oit.edu/faculty/longj/CST211Lab1.htm

I am working on the questions from 7~19. If you would like I can send you the code that I have written for this lab. I have the program so that it works just fine and all but the casting stuff is a bit rusty in my mind. I took the class that we are reviewing about a year ago so its not in my book for this class and the instructor is gone for the weekend.

To anyone that helps thankyou very much in advance!
 
Old 05-11-2004, 01:11 AM   #2
irfanhab
Member
 
Registered: Jan 2004
Location: Pakistan
Distribution: OpenSuse 10.2, Slackware 11, Solaris 10
Posts: 415

Rep: Reputation: 34
Casting is used in C++ to forcibly convert a data type to another data type.

C++ handles automatic data type conversion when it is up the tree:, the following tree:

char
short
int
float
long
double
long double

Now if you try to convert a long double to int, u need casting, however assigning a int to a long no casting is required.


This is static casting

I am not clear about dynamic casting, but I think its something to do with casting pionters, perhaps someone else in this forum could clear dynamic casting up.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
A Couple of C++ questions, casting -0- Programming 7 06-27-2005 12:14 PM
casting question in kernel source code linetnew Programming 3 04-18-2005 04:55 AM
How to do type casting in Sparc Assembly Language foxele Programming 1 10-09-2004 04:40 PM
casting cynthia Programming 6 10-05-2004 03:58 AM
c++, casting, templates kev82 Programming 0 08-24-2004 05:09 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration