Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Meaning of Explicit and Implicit Conversion

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 30-01-2010
Member
 
Join Date: Nov 2009
Posts: 877
Meaning of Explicit and Implicit Conversion
  

Hello, I have just started learning programming languages. While learning it, I have come to know that there is basically two types of basic conversion available in it, which are Explicit and Implicit Conversion. I have search on this but there is not in detail information on it. If someone is having that then please provide me that. If you provide me some examples then it will be more helpful to understand.

Reply With Quote
  #2  
Old 30-01-2010
Member
 
Join Date: Apr 2008
Posts: 1,944
Re: Meaning of Explicit and Implicit Conversion

Explicit conversion: It is used to force the conversion of a data type to another type using keywords.
Example
Code:
number As Double = 6.53
num As Integer
num=CType(number, Integer)  'conversion a worth double in Integer
There are also implicit conversion done automatically without special syntax and transparent manner.
VB can afford it (If Option Explicit Off in the setup)
Example
Code:
number As Double = 2.65
num As Integer
num=number  'For affect to num the Double number Vb has transformed the double number in Integer.
Reply With Quote
  #3  
Old 30-01-2010
Member
 
Join Date: Apr 2008
Posts: 1,993
Re: Meaning of Explicit and Implicit Conversion

Hi, If you are making use of the implicit conversion then you need not require to use the any type of special syntax in the source code. If your code is implicitly converting the value of variable to a single-precision floating-point value before assigning it to another variable. If you are making use of an Explicit conversion then you can simply make use of the type conversion keyword. Visual Basic provides several such keywords.
Reply With Quote
  #4  
Old 30-01-2010
Member
 
Join Date: May 2008
Posts: 2,001
Re: Meaning of Explicit and Implicit Conversion

See the code below for the implicit and explicit conversion :
Code:
Dim num As Integer
Dim num2 As Double
num = 432
num2 = K

num2 = Math.Snum2rt(num2)
num = CInt(num2)
Reply With Quote
  #5  
Old 30-01-2010
Member
 
Join Date: May 2008
Posts: 2,283
Re: Meaning of Explicit and Implicit Conversion

If you consider the Sql then you can able to get the following example for the explicit and implicit conversion:
Implicit Conversion :
Code:
SELECT * FROM emp
WHERE hiredate between '01-Feb-2000' and '01-Feb-2001';
Explicit Conversion :
Code:
SELECT *  FROM emp
WHERE hiredate between TO_DATE('01-Feb-2000', 'DD-MON-YYYY') and O_DATE('01-Feb-2001', 'DD-MON-YYYY');
Reply With Quote
  #6  
Old 30-01-2010
Member
 
Join Date: Oct 2005
Posts: 2,385
Re: Meaning of Explicit and Implicit Conversion

Explicit conversion requires an explicit casting in c#.
For example,
Code:
Employee emp = new Employee();
Customer cust = (Customer) emp;
Implicit conversion is done automatically by the compiler.
For example,
Code:
Employee emp = new Employee();
Customer cust = emp;
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Meaning of Explicit and Implicit Conversion"
Thread Thread Starter Forum Replies Last Post
What is difference between implicit type casting and explicit type casting in C++? Palnila Software Development 4 01-01-2011 11:25 PM
Difference between Implicit & Explicit type conversions Sarfaraj Khan Software Development 5 09-02-2010 01:47 PM
What are the implicit objects in JSP? Coffee Software Development 3 07-08-2009 05:27 PM
Bypass implicit operator conversion Sujit15 Software Development 3 14-05-2009 11:02 AM
Difference between Implicit and Explicit Declaration vinodpathak_214 Software Development 3 16-01-2009 09:00 AM


All times are GMT +5.5. The time now is 02:58 PM.