#include <iostream.h>
#include <conio.h>


class Time
{
	private:
	int minutes;
	int hours;
	public:
	Time()
	{

	}
	Time (int x)
	{
		hours=x/60;
		minutes=x%60;
	}
	void display()
	{
		cout<<"Hours = "<<hours<<endl;
		cout<<"Minutes = "<<minutes<<endl;
	}

};


int main()
{

	Time t1;
	t1=72;
	t1.display();

}
Type Conversion in CPP – Conversion from Basic type to Class Type

Leave a Reply

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