Tuesday, September 10, 2013

On Converting Ada to Python Pt 1

So rather than using Overloaded operations on each kind of "type" you would want to make the class (which I'm using as types now) have the operation.
I.E.
Ada:
   function Convert_to_Something(This : in Dog) return Animal is
   begin
      return This.Animal
   end Convert_to_Something

Python

(in class definition)
class   Dog:
   def Convert_To_Something(self):
      return self.Animal


How they're called:
Ada:
   Convert_to_Something(This)
Python
   .Convert_To_Something()

No comments:

Post a Comment