<?php
class MyClass {
private $myName;
private $myAdress;
function __construct ($myName, $myAdress){
$this->myName=$myName;
$this->myAdress = $myAdress;
}
function print1 (){
echo "My Name is: $this->myName <br/>";
echo "My Adress is: $this->myAdress \n";
}
}
//=========================================================
// Реализация класса
$myClass = new MyClass("aaa", "2323232300000000");
$myClass->print1();
?>
<?php
class MyClass {
private $myName;
private $myAdress;
/*
function __construct (){
$this->myName=$myName;
$this->myAdress = $myAdress;
*/
function setMyName($myName){
$this->myName=$myName;
}
function print1 ($myName, $myAdress){
echo "My Name is: {$this->myName} <br/>";
echo "My Adress is: $myAdress \n";
}
}
//=========================================================
// Реализация класса
$myClass = new MyClass();
$myClass->setMyName("ddddd");
$myClass->print1("sssss", "1111111111111111");
?> |
<?php
class MyClass {
private $myName;
private $myAdress;
function __construct ($myName, $myAdress){
$this->myName=$myName;
$this->myAdress = $myAdress;
}
function print1 (){
echo "My Name is: $this->myName <br/>";
echo "My Adress is: $this->myAdress \n";
}
}
//=========================================================
// Реализация класса
$myClass = new MyClass("aaa", "2323232300000000");
$myClass->print1();
?>
<?php
class MyClass {
private $myName;
private $myAdress;
/*
function __construct (){
$this->myName=$myName;
$this->myAdress = $myAdress;
*/
function setMyName($myName){
$this->myName=$myName;
}
function print1 ($myName, $myAdress){
echo "My Name is: {$this->myName} <br/>";
echo "My Adress is: $myAdress \n";
}
}
//=========================================================
// Реализация класса
$myClass = new MyClass();
$myClass->setMyName("ddddd");
$myClass->print1("sssss", "1111111111111111");
?>