#include <conio.h>
#include <iostream>
usingnamespace std;
class angka
{
public :
int a;
angka(int a)
{
cout<<"input yang anda masukan adalah"<<a;
}
~angka()
{
cout<<endl<<"destruct jalan";
}
};
int main(){
int x;
cout<<"input 1 angka ";
cin>>x;
angka( int x);//this one didnt work
getch();
return 0;
}
It hit me lat night just as the computer shut down. SakurasouBusters suggestion although correct in removing the int makes no difference because you are calling the constructor and that is not allowed.
what you can do is after line 23 add angke test(x); this way when you create an instance of class angka the constructor will be call passing x to the constructor.