Re: Object Oriented Programming and Euphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message

Caracatsanis Pty Ltd wrote:

> >From my reading I've gained the impression that routine_id() facilitates
> OOP. I'm fairly new to programming, but would appreciate a simple
> understanding of the way OOP may be achieved in Euphoria. I've read about
> routine_id() in the documentation, and can see what it does, but not how it
> relates to OOP.
>
> For example suppose I define a general class called "Shape". Suppose I
> declare its (private) data members to be "length", "height", and "area".
> Suppose I declare its (public) member functions to be "CalculateArea" and
> "ShowResult". I then create a constructor to allow me to put data into
> "length" and "height". I define "CalculateArea" such that: area = length *
> height. And I define "ShowResult" using an appropriate output statement. I
> call a specific instance of "Shape" - let's say "Square" - input specific
> values for "length" (eg 3) and "height" (eg 4), return a value of 12 from
> "CalculateArea", and display it on screen using "ShowResult".
>
> Is it possible to use this trivial example to demonstrate how the OOP
> concept can be handled by Euphoria?
>
> Thank you
>
> Alex Caracatsanis

Euphoria doesn't have any built-in OOP syntax, and routine_id isn't directly
related to OOP. routine_id is simply a way of getting a pointer to a function
(then you can use call_proc or call_func to call it). There are several
libraries which allow you to do OOP in Euphoria, but their use of routine_id
is simply for dynamic calls - it is not related to OOP.

Jeff Fielding

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu