Object Oriented Programming and Euphoria
- Posted by Caracatsanis Pty Ltd <sunpsych at VIC.OZLAND.NET.AU> Aug 12, 2000
- 444 views
>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