Converting Prosedural Style to OOP Taste
Posted: Mon Mar 16, 2009 1:13 am
i am learning in OOP code, but seem like a little "stucked" when trying to converting function based on prosedural to OOP taste, i hope someone who have more experienced than us can help me out to make some solution :
for me it's kinda hard to be implemented due to the second switch line is taking variable from the first switch line ($A2), what a mess for a beginner like me.....
thx for the reply and hoping this will help other person who got stuck on OOP implementation....
Thank for reply one again....
this code can be run in prosedural style
Code: Select all
if ($in1!='' or $jur1!='' or $thn1!='')
{
CekKolom3($in1,$jur1,$thn1,$inf3); // the code for the function is on another page but it's worked
$A1=true;
}
switch ($A1) {
case 1:
if($in2!='' and $jur2 !="" and $thn2 !="") {
$A2=true; }
elseif ($in2!='' or $jur2 !="" or $thn2 !="") { exit ("the second Data is not Complete yet"); }
break;
case 0:
if($in2!='' or $jur2 !="" or $thn2 !="")
{ exit ("Data pertama belum terisi");}
break; }
switch ($A2) { //this variabel taking from the above switch.
case 1:
if($in3!='' and $jur3 !="" and $thn3 !="") {
$A3=true; }
elseif ($in3!='' or $jur3 !="" or $thn3 !="") { exit ("the second Data is not Complete yet"); }
break;
case 0:
if($in3!='' or $jur3 !="" or $thn3 !="")
{ exit ("Data Kedua belum terisi");}
break; }
thx for the reply and hoping this will help other person who got stuck on OOP implementation....
Thank for reply one again....
this code can be run in prosedural style
Life Isn't easy as it Thought but some help out there never gone.