#include
using namespace std;
class persegi{
private:
int panjang;
int lebar;
public:
persegi();
void input();
int hitungLuas();
};
persegi::persegi(){
cout<<"konstruktor dijalankan \n";
}
void persegi::input(){
cout<<"Masukan panjang :";
cin>>panjang;
cout<<"masukan lebar :";
cin>>lebar;
}
int persegi::hitungLuas(){
int hasil;
hasil=panjang*lebar;
return hasil;
}
int main(int argc, char *argv[])
{
persegi objek;
objek.input();
cout<<"Luas : "<
return EXIT_SUCCESS;
}
Posted by 22.52 and have
0
comments
, Published at