BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan

BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan (http://bzupages.com/)
-   Object Oriented Programming (http://bzupages.com/35-object-oriented-programming/)
-   -   Class's & Objectess at 19 Program By Mam. (http://bzupages.com/f35/classs-objectess-19-program-mam-753/)

shmsa 19-09-2008 05:19 PM

Class's & Objectess at 19 Program By Mam.
 
Code:

#include
#include
using namespace std;
class time
{
private:
 int hours;
 int minutes;
 int seconds;
 int sum;
 //static int count;
public:
 time()
 {
  hours=10;
  minutes=10;
  seconds=10;
  sum=0;//count=0;
  //count++;
 }
 time(int var1,int var2,int var3)
{
 hours=var1;
 minutes=var2;
 seconds=var3;
}
 void showtime()
 {
 
  cout<  
 
 }
 void power()
 {
  int pow=1;
  for(int i=0;i<=10;i++)
  pow=pow*2;
  cout<  
 }
 void power(int var1)
 {
  int pow=1;
  for(int i=0;i<=10;i++)
  pow=pow*var1;
  cout<  
 
 }
/* int power(int var3)
 {
  int pow=1;
  for(int j=0;j<=10;j++)
  pow=pow*var3;
  return pow;
 
 
 }*/
 void power(int var2,float var3)
 {
  int pow=1;
  float val=0.0;
  for(int i=0;i<=10;i++)
  pow=pow*var2;
  val=pow*var3;
 cout<  
 
 
 
 }
 
 void power(float var4)
 {
  float pow=1.0;float val2;
  for(int i=0;i<=10;i++)
  pow=pow*var4;
  val2=pow*2.0;
  cout<<"value is"<  }
 void func2();

};
void time::func2()
{
 cout<<"you are in function 2"< }
int main()
{
 time t1;int var1=3,var4;float val3=2.0;
 //t1.showtime();
 time t2;
 time t3,t4;
 //t4.showtime();
 t1.func2();
 //.power();
 //.power(var1);
 //.power(2,3.0);
 //.power(val3);
 return 0;
}


.BZU. 14-10-2008 01:53 AM

Re: Class's & Objectess at 19 Program By Mam.
 
This program is also describing the Function Overloading..
i.e: program has same functions but different body, and the main function distinguish these same name functions by comparing the arguments in the function. :thumbup:
Samjhay....


All times are GMT +5. The time now is 01:37 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.