Class –Class
Vo Hoti Hai Jiska Use Hm Object Ki Properties,Behave,Method Ko Define Karne Ke
Liye Karte Hai.
Objects-Objects
Wo Hote Hai Jinhe Aap Class Ke Andar Create Krte Ho.
Syntax For Object And Class
Class Tv
{
$Modal;
$Volume;
$Color;
}
Dosto Uppar
Diye Gye Example Me Aap Dekh Rhe Ho Ki Class Tv Jo Hai Wo Class Hai. Or Iske
Andar Jo $Model,$Volume,$Color Hai Ye Sbhi Objects Hai. Dosto Aap Ek
Simple Sa Example Le Skte Hai Jese Ki Car.
Car(Class)
Car Ki
Type(Objects)-Audi,Maruti,Alto,Bmw Etc Ye Sbi Objects Hai.
Syntax for defing class in php
class phpClass {
var $var1;
var $var2 = "constant string";
function myfunc ($arg1, $arg2) {
[..]
}
?>
Class ke
ander hm variable or function ko define karte hai
Class tv{
Public $model;
Public $volume;
Function volumeup(){
Return this->volume++;
}
Function volumedown(){
Return this->volume--;
}
}
$tv=new tv;
Echo $tv->model;
?>
Dosto aap is
example me dekh skte ho ki class ke andar variables aur function ko define kiya
hua hai.Yanha par
variables $model aur $volume hai.Aur function
function vlumeup() and function volumedown hai
Or jo public
hai wo access specifiers hai jo tin type ke hote hai
- Public
- Private
- Protected
Inke bare me
detail me mai apko apne agli post me btaunga.
Thank You
Team
Gajabwap Web In Hindi
Also read-
Also read-
ConversionConversion EmoticonEmoticon