By | May 16, 2017

Swap two numbers

This program illustrate how to swap two numbers using the concept single level inheritance without using third variable.We have made two classes.In first class i.e. “base” user will input a values using function “get()” and in second class i.e “scan” which extends the “base” class swaping of two numbers will be performed using function “swap()” and result will be displayed using function “display()”. The all three functions will be called by object of “scan” class i.e. “d1”.

Logic to swap two numbers without using third variable


swap two numbers

Leave a Reply

Your email address will not be published. Required fields are marked *