How can you force a set of classes to define a private method if Interface
members cannot be declared public, private, protected, or internal?
Create an abstract class with private method(s) that throw an error, unless
overwritten by subclasses? Is this the only way?
Hello,
You cannot force a class to implement a private method. And that would be
totally useless... The target of an interface is to define a set of methods
that are accessible by any classes = private, internal and protected
methods are too restricted. What do you want to do ?
Regards,
Cedric
On Mon, Aug 4, 2008 at 9:37 AM, Ian Thomas [EMAIL PROTECTED] wrote:
Why would you want to force implementation of a private class?
Private method. Sorry!
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
Why would you want to force implementation of a private class?
Or are you actually trying to create an abstract class - and are
trying to ensure that a subclass provides an implementation of an
internal method? (Labelled as 'private' in AS2 or 'protected' in AS3.)
In which case, neither AS2 nor
@chattyfig.figleaf.com
Sent: Wednesday, April 02, 2008 1:58 AM
Subject: Re: [Flashcoders] Interfaces
Well, the example in the blog explained it a lot, though it is in
Actionscript 2.0.
And yes, I wont need Interfaces unless I really feel like I HAVE to use
them.
In my project I have some Panels
list,
I've been reading tons of books and I still can't get the concept of
Interfaces.
Can someone explain it with an easy example for me?
Help will be really appreciated.
--
Omar M. Fouad - Digital Emotions
http://www.omarfouad.net
This e-mail and any attachment is for authorised use by the
I've been reading tons of books and I still can't get the
concept of Interfaces.
It's actually very very simple. An interface is just a special class
that sets the rules of other classes. So an interface doesn't do
anything in your application, it just helps the coder(s) to make sure
they
Yeah, but I've read that a Class that implements an interface an call
function from other classes that allready extends other Classes.
it's like a multiple inheritance. But how can I achieve it?
On Tue, Apr 1, 2008 at 10:30 PM, Merrill, Jason
[EMAIL PROTECTED] wrote:
I've been reading tons of
Yeah, but I've read that a Class that implements an interface
an call function from other classes that allready extends
other Classes.
it's like a multiple inheritance. But how can I achieve it?
I don't quite follow what the issue is, but don't confuse inheritance
with implements. Do you mean:
An interface is used to make sure your code is not tightly coupled. Instead
of saying which class should be given, you say which interface should be
given. This means that a developer has more freedom to implement his own
version of an interface.
Lets say you make a person interface called
Interfaces can do much more than just help multiple coders stay on
track. In Actionscript 3, they can be used to mimic multiple
inheritance, decrease file size of loaded swfs, and clarify your own code.
Interfaces are simple, but understanding Interfaces and how and when to
use them takes a
On Apr 1, 2008, at 1:19 PM, Omar Fouad wrote:
list,
I've been reading tons of books and I still can't get the concept of
Interfaces.
Can someone explain it with an easy example for me?
Help will be really appreciated.
This guy's example gave me a good foothold. Maybe it will help:
If you're the only person working on a project, interfaces can be less
useful unless you know how to use them well. Putting them in just to
put them in serves no purpose other than bloating your code. But,
sometimes you need to do that in order to figure them out.
I'd even go as far as
Well, the example in the blog explained it a lot, though it is in
Actionscript 2.0.
And yes, I wont need Interfaces unless I really feel like I HAVE to use
them.
In my project I have some Panels (screens) in the fla Library and each one
of them is linked to a Class (linkage). Each class or Panel
flashcoders@chattyfig.figleaf.com
Sent: Wednesday, April 02, 2008 1:58 AM
Subject: Re: [Flashcoders] Interfaces
Well, the example in the blog explained it a lot, though it is in
Actionscript 2.0.
And yes, I wont need Interfaces unless I really feel like I HAVE to use
them.
In my project I have
Hi Ian,
an intrinsic is not used only for built-in Flash Player classes/code.
You can use it to save yourself some time, since the compiler doesn't
compiler the bytecode all again.
With intrinsics no bytecode is generated, only type-checking is done.
With interfaces bytecode is generated.
I'm
Hi Ray,
I know what intrinsics are, what they're _supposed_ to be for, and
what they're actually used for. :-)
It's a matter of personal preference. I don't use them because, as I
said earlier, I can do things in other ways. For the purpose I was
talking about - seperating code into different
Hi,
can't this be done with intrinsics?
http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Partsfile=1879.html
On 10/14/06, Ian Thomas [EMAIL PROTECTED] wrote:
On 10/13/06, Jim Kremens [EMAIL PROTECTED] wrote:
I understand what interfaces
can't this be done with intrinsics?
Ray, an interface does not include variables, so this example looks more
like an Abstract class.
intrinsic class Circle {
var radius:Number;
function Circle(radius:Number);
function getArea():Number;
function getDiameter():Number;
function
Hi Ray,
Yes - but why would you, if the language spec already supports
interfaces? Using interfaces is a much more 'standard' way (i.e. the
same sort of thing you'd do if you were talking to dynamic libraries
in other languages).
I still see intrinsics as a bit of a hack. These classes are
Scott,
To me, an abstract class is one which has a partial - but incomplete
- implementation i.e. you should never find yourself writing new
SomeAbstractClass() - you should only ever be creating objects derived
from it. The abstract class contains some useful re-usable stuff, but
can't function
Ian,
That being the case, I can't quite see how intrinsics apply, as by
their nature they include no implementation at all.
Ah, good point. I just got excited when I saw that variable in there. It is
one step closer to abstract.
Oddly, in AS3 Macrodobe have
taken out the facility to mark
Hi list...
I understand what interfaces are, but I'm not entirely clear on when
they become advantageous to use. Anyone care to shed some light?
Thanks,
- Michael M.
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search
Design principle:
'Code to interface, not implementation'.
Say you have classic MusicPlayer interface (and this is all psuedo-code):
play()
stop()
ok, now I've got CDPlayer implements MusicPlayer:
play()
stop()
==
nextTrack()
and TapePlayer implements MusicPlayer:
play()
stop()
==
Mendelsohn, Michael wrote:
Hi list...
I understand what interfaces are, but I'm not entirely clear on when
they become advantageous to use. Anyone care to shed some light?
Thanks,
- Michael M.
___
Flashcoders@chattyfig.figleaf.com
To change your
I understand what interfaces are, but I'm not entirely clear on when
they become advantageous to use. Anyone care to shed some light?
I find them really useful for implementing the strategy pattern, and I find
the strategy pattern to be extremely useful in Flash.
Let's say, for example, that
On 10/13/06, Jim Kremens [EMAIL PROTECTED] wrote:
I understand what interfaces are, but I'm not entirely clear on when
they become advantageous to use. Anyone care to shed some light?
Interfaces are also very handy when you want to put the actual
implementation code for a class in one .swf,
Hi,
i'm using a collection, which requires items of type Object to be added.
I've declared an interface which gives me something like:
- interface IWorldPart
- a class implementing WorldPart
now somewhere else i do:
var myPart:IWorldPart = new SomeWorldPartSubclass();
myCollection.addItem
Um... not quite sure what you're up to here - but it sounds like you're
getting a bit confused between IWorldPart and WorldPart.
What you need is:
interface IWorldPart
class SomeWorldPartSubclass implements IWorldPart
then
var myPart:IWorldPart = new SomeWorldPartSubclass();
should be fine.
Well, you can't instanciate an interface, you need first a concrete
class that implements the interface...
Your code should be:
interface IWorldPart {}
class SomeWorldPartSubclass implements IWorldPart {}
var myPart:SomeWorldPartSubclass = new SomeWorldPartSubclass();
Well, you can't instanciate an interface, you need first a concrete
class that implements the interface...
While you cannot instantiate an interface, you can assign an object
that is an instance of a class that does implement the interface to a
variable that is typed to the interface.
No, you can't instantiate an interface. But I don't think Hans was doing
that.
There's no problem with typing:
interface IWorldPart {}
class SomeWorldPartSubclass implements IWorldPart {}
var myPart:IWorldPart = new SomeWorldPartSubclass(); /* Note
INTERFACE-typed var, not concrete */
SomeWorldPartSubclass();) by the way.
Thanks for your comments,
H
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas
Sent: Wednesday, February 01, 2006 12:36 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] interfaces and objects
Um... not quite
H
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Julien
Vignali
Sent: Wednesday, February 01, 2006 12:49 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] interfaces and objects
Well, you can't instanciate an interface, you need first
Then as Steve says, sounds like a compiler bug.
Ian
On 2/1/06, j.c.wichman [EMAIL PROTECTED] wrote:
Hi,
No confusion here ;) except maybe for my fuzzy explanation ;).
I did:
interface IWorldPart
class WorldPart implements IWorldPart
class SomeWorldPartSubclass extends WorldPart
then
]
[mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas
Sent: Wednesday, February 01, 2006 1:05 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] interfaces and objects
No, you can't instantiate an interface. But I don't think Hans was doing
that.
There's no problem with typing:
interface
But it should. :-)
Like I said, my quick test of
var myPart:SomeInterface=new SomeConcreteImplementingSomeInterface();
trace(myPart instanceof Object);
Traces 'true'. Which is what I'd expect.
I really don't understand why you're getting an error with myCollection.
I know you've solved your
is not regarded by flash then
of being of type Object as well.
Got it figured out now ;)
Thanks
H
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Julien
Vignali
Sent: Wednesday, February 01, 2006 12:49 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders
mailing list
Subject: Re: [Flashcoders] interfaces and objects
But it should. :-)
Like I said, my quick test of
var myPart:SomeInterface=new SomeConcreteImplementingSomeInterface();
trace(myPart instanceof Object);
Traces 'true'. Which is what I'd expect.
I really don't understand why you're getting
Hi,
Yes steve was completely right about that.
Thanks all!
H
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas
Sent: Wednesday, February 01, 2006 1:19 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] interfaces and objects
MX2004
Cheers,
Ian
On 2/1/06, j.c.wichman [EMAIL PROTECTED] wrote:
Hi Ian,
Which flash version are you using?
I had other problems yesterday with extending CollectionImpl due to my
flash
version (mx 2004), which worked just fine in flash 8. Might be the same in
this case.
Are you
'Fraid not. One to chalk down to experience, I guess. Oh well. I'm making
the move to 8 shortly myself, once this latest crop of projects are out of
the way...
Ian
On 2/1/06, j.c.wichman [EMAIL PROTECTED] wrote:
Life is so unfair :)
I had to switch to flash 8 to make it go away... My mind
42 matches
Mail list logo