note 19472 added to language.oop
| From: | alebiasin at yahoo dot com | Date: | Thu, 28 Feb 2002 14:26:13 +0000 |
| Subject: | note 19472 added to language.oop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27169@lists.php.net to get a copy of this message | ||
It's possible to extend a class in PHP, from a class made with Visual Basic in a DLL.
Read the post saying "It's possible to 'redefine' a class using $this".
EXAMPLE:
1) Create a class in Visual Basic like this:
Project Name: projectA
Class Name: ClassA
Public strPP As String
Private Sub Class_Initialize()
strPP = "Inicializado"
End Sub
Public Function a() As String
a = "A_" & strPP
End Function
2) Create a class in PHP like this:
<?
class classB
{
function classB()
{
// Cambio el puntero de esta clase, por el de la clase de Visual Basic
$this = new COM("projectA.classA");
}
}
$B = new classB;
echo $B->A()."<BR>"; // Uso el metodo A() de la clase de Visual Basic classA
$B->strPP = "Hola!!!"; // Propiedad strPP de la clase de Visual Basic classA
echo $B->A()."<BR>";
?>
3) Execute it! It should output this:
A_Inicializado
A_Hola!!!
--
http://www.php.net/manual/en/language.oop.php
http://master.php.net/manage/user-notes.php?action=edit+19472
http://master.php.net/manage/user-notes.php?action=delete+19472
http://master.php.net/manage/user-notes.php?action=reject+19472