note 19472 deleted from language.oop by vincent
| From: | vincent@php.net | Date: | Thu, 11 Sep 2003 19:58:56 +0000 |
| Subject: | note 19472 deleted from language.oop by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-56201@lists.php.net to get a copy of this message | ||
Note Submitter: alebiasin@yahoo.com
----
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!!!