Subclassing Sound

I can’t get this to work. I’m trying to subclass Sound to override Open and Play, but can’t figure out how to assign the result from Sound.Open(file) to itself. Compiler keeps showing syntax error.

Any ideas?

In which version of Xojo as the answer depends on that somewhat :slight_smile:

In 2019r3.1 Open is a Shared Class Method
So you probably cannot overload it in your subclass

Yes, 2019r3.1

Ah, didn’t realize that Open was a Shared Method. Yes, that throws a wrench into it.

Guess I’ll have to approach it a different way. Thanks.

would a wrapper class that internally has a protected sound property work just as well for your purposes ?

Yes, that’s exactly the direction I was heading. Great minds think alike? :wink: