conversion between objects of different classesas


Conversion between Objects of Different Classes

As the compiler does not know anything about the user-defined type, the conversion instructions are to be specified in a function. The function can be a member function of the source class or a member function of the destination class. We will consider both the cases.

Consider a class DistFeet which stores distance in terms of feet and inches and has a constructor to receive these. The second class DistMetres store distance in metres and has a constructor to receive the member

 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: conversion between objects of different classesas
Reference No:- TGS0309404

Expected delivery within 24 Hours