Re: PHP to a COM object




"Csaba Gabor" <danswer@xxxxxxxxx> wrote in message
news:892b2933-e964-4f5a-bbb5-f8d822f8f48b@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Steve, thanks for your awesome exposition on VB interfaces, replete
with example. This type of post is all too rare on the web.

Csaba

wow! thanks. i'm glad it helped.

cheers.

On Nov 14, 8:10 pm, "Steve" <no....@xxxxxxxxxxx> wrote:
"Alex" <d_key...@xxxxxxxxxxx> wrote in message
...
a difference, yes. something that will make your code quit bombing and
still
get the Factory functionality...probably not. all an interface (IFactory
in
this case) is, is a contract...a definition of what *all usable* objects
that *implement* that interface will provide a caller, i.e. your php
code.
make sense? IFactory will provide you no other functionality than that.
here's an example in vb.

public interface iFactory
public property foo as integer
end interface

public class sawMill
implements iFactory
public property get foo() implements iFactory.foo
get
return 666
end get
set (byval value as integer)
# do nothing...however, set is *required*
# because iFactory is read/write
end property
public function saw()
debug.print "sawing..."
end function
end class

public class brewery
implements iFactory
private myFoo as integer
public property get foo() implements iFactory.foo
get
return myFoo
end get
set (byval value as integer)
myFoo = value
end property
public function brew()
debug.print "brewing " & myFoo
end function
end class

in the above, both completely unrelated classes (sawMill and brewery)
have
iFactory.foo as part of their definition. how they implement them is
different, but each must have a read and write foo.

if i simply say:

private myFactory as iFactory

and then try:

myFactory.foo()

it will do nothing. myFactory is an interface that has no working parts.
however, if i do:

private myFactory as iFactory = new brewery
myFactory.foo = 15

i'll get somewhere. notice that the above works whether or not i set
myFactory to new brewery OR sawMill. both have a foo interface. however,
if
i continue the above code with:

myFactory.saw()

it'll blow up. both saw and brew are specific interfaces defined by each
class respectively...not by iFactory. let's say that myFactory is set
somewhere unbeknownst to me, how would i take specific action?

public function factoryToString(byval factory as iFactory, byval fooValue
as
integer)
factory.foo = fooValue
if typeof factory is sawMill then
factory.saw()
end if
if typeof factory is brewery then
factory.brew()
end if
end function

anyway...i think i got off track, but does that help you know that you're
going to have to get at an actual Factory object in the list...which
doesn't
solve your memory problem?


.



Relevant Pages

  • Re: PHP to a COM object
    ... This "factory" object is an instance of a class called Factory. ... doc also makes mention of something called an interface (IFactory) who has ... }When I do it on the interface, I get all my object's properties. ... myFactory is an interface that has no working parts. ...
    (comp.lang.php)
  • Re: PHP to a COM object
    ... get the Factory functionality...probably not. ... that *implement* that interface will provide a caller, ... IFactory will provide you no other functionality than that. ... myFactory is an interface that has no working parts. ...
    (comp.lang.php)
  • Re: Dynamic inheritance
    ... >I've been reading the Factory and Abstract Factory patterns - and finding ... It seems the problem boils down to where/when to instantiate ... We have an interface named DeviceFactory. ... >Since most devices would be Cisco devices the 'cisco device' subclass would ...
    (comp.object)
  • Re: Dynamic inheritance
    ... >I've been reading the Factory and Abstract Factory patterns - and finding ... It seems the problem boils down to where/when to instantiate ... We have an interface named DeviceFactory. ... >Since most devices would be Cisco devices the 'cisco device' subclass would ...
    (comp.programming)
  • Re: Design Question
    ... You could advocate that all public methods should be declared in an interface, such that you would have no concrete class that did not implement at least one interface. ... You will have to add new getters and setters to the interface just as you would to the class, and factory method signatures will change just like constructor signatures would. ... In the approach I was advocating, the Record class would have no knowledge of persistence. ...
    (comp.lang.java.programmer)