Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 processes in classes?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Clayton




PostPosted: Wed Apr 26, 2006 8:32 pm   Post subject: processes in classes?

is it possible to have a process in a class that you can call (or in a module for that matter) for a music player that i am working on?(im being asked to do it OOT)
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Apr 26, 2006 10:40 pm   Post subject: (No subject)

I think you're looking for Music.PlayFileReturn
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
[Gandalf]




PostPosted: Thu Apr 27, 2006 12:07 am   Post subject: (No subject)

And to answer your question, yes, it is possible to have a proccess, procedure, function, type, variable, or basically anything else inside a class.
Clayton




PostPosted: Thu Apr 27, 2006 12:58 pm   Post subject: (No subject)

so would you do something like this
Turing:

class Play
export play_from_cd
process play_from_cd
end play_from_cd
end Play

var p:^Play
new Play,p

fork Play(p).play_from_cd
Tony




PostPosted: Thu Apr 27, 2006 1:14 pm   Post subject: (No subject)

no, because that code doesn't work.. have you tried?

I'd do something like
code:

class Play
    export play_from_cd

    process play_process
        for i : 1 .. num_tracks
            Music.PlayFile (filename (i))
        end for
    end play_process

    procedure play_from_cd
        put "lets play"
        fork play_process
    end play_from_cd
end Play

var p : ^Play
new Play, p

p -> play_from_cd


it appears that you can call only procedures and functions, not processes. Though you could create an internal function that would call a process on user's behalf.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
codemage




PostPosted: Thu Apr 27, 2006 1:24 pm   Post subject: (No subject)

It's possible to use a process to do that, but it's also possible to feed yourself by placing a chocolate bar between your buttocks and ramming it home with a broomstick.

I don't highly recommend either though.
md




PostPosted: Thu Apr 27, 2006 2:25 pm   Post subject: (No subject)

Using processes in classes is not possible. Using processes is not possible. There is no such thing as processes.

Really, unless you are _complete_ comfortable with the rest of the entire language, and with threading models, and many many other ideas, processes are not something you should even be thinking about.
Clayton




PostPosted: Thu Apr 27, 2006 4:09 pm   Post subject: (No subject)

ok thanks tony that was i kinda obvious thing to do (just didnt try it lol)
Sponsor
Sponsor
Sponsor
sponsor
Martin




PostPosted: Thu Apr 27, 2006 11:57 pm   Post subject: (No subject)

codemage wrote:
It's possible to use a process to do that, but it's also possible to feed yourself by placing a chocolate bar between your buttocks and ramming it home with a broomstick.

I don't highly recommend either though.


"Windows is easier than Linux, in the same way that crapping your pants is easier than going to the washroom." Wink
codemage




PostPosted: Fri Apr 28, 2006 8:45 am   Post subject: (No subject)

That's a good one. Surprised
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: