Welcome Hello all my name Ang MengEang .I created this website for IT knowlegth and watch News This blog is updating Please wait for Vsiting .My Website will be update soon Thanks very much from me !

Code CAdd Constructor



#include<conio.h>
#include<iostream>
using namespace std;
class CAdd{
public:
int one;
CAdd(int two){
cout<<"Contructor with paramater "<<endl;
one = two;
}
CAdd(){
cout<<" Default Contructor"<<endl;
}
~CAdd(){
cout<<" Descontructor of programs" <<endl;
}
int add(){
return(one + one);
}
};
int main(){
CAdd myObj1(4);
CAdd myObj2;
cout<<"The value of Obj 1 : "<<myObj1.add()<<endl;
cout<<"Please enter value : ";
cin>>myObj2.one;
cout<<"The value of Obj 2 : "<<myObj2.add()<<endl;
getch();
return 0;
}

0 comments:

Copyright © 2014 IT Kampong Cham - Template by SoraTemplates Email :eangkpc@gmail.com , Tell: 086 81 95 77.