NTA-NET (UGC-NET) Computer Science & Applications (87) Programming in C and C Plus Plus-C Plus Plus Programming Study Material (Page 31 of 54)

Choose Programs:

⏳ 🎯 Online Tests (4 Tests [100 questions each]): NTA Pattern, Analytics & Explanations

Rs. 800.00 -OR-

3 Year Validity (Multiple Devices)

Sample TestsDetailsSee Demo

🎓 Study Material (2083 Notes): 2024-2025 Syllabus

Rs. 1250.00 -OR-

3 Year Validity (Multiple Devices)

Topic-wise Notes & SampleDetails

🎯 2699 MCQs (& PYQs) with Full Explanations (2024-2025 Exam)

Rs. 600.00 -OR-

3 Year Validity (Multiple Devices)

CoverageDetailsSample Explanation

Help me Choose & Register (Watch Video) Already Subscribed?

Conversion Function

Edit

Introduction

We may recall that when we assign a value of specific data type to the variable of another type, the implicit conversion takes place.

For example, if we have two variables declared as follows,

  1. int x =10;
  2. float y;

We can have followi…

… (388 more words, 19 figures) …

Subscribe (by clicking here) to view full notes and track progress.

Standard Data Type to Class

Edit

This Conversion can be achieved by single parameter constructor. For example, if we wish to convert an integer to time object. We can define a constructor in time class which takes single integer parameter

  1. void main ( )
  2. {
  3. int second;
  4. Time t;
  5. t =second; //Will work
  6. } ;

Having defined this constructor, we will be able to do following assignment.

Object of One Class to Object of Another Class

It is also possible to assign object of one class to object of another class. Let us understand it with the help of an example, if we have two class namely INR and USDOLLLAR

If we have following objects defined.

  1. INR mymoney;
  2. USDOLLAR yourmoney;

We c…

… (286 more words, 53 figures) …

Subscribe (by clicking here) to view full notes and track progress.