[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> Elias Pschernig wrote:
>> I.e., Allegro defines its very own cos function, just with fix types
>> instead of double. As a C programmer, I don't like this.. but I guess
>> in C++ it's standard to define all math operators/functions for every
>> mathematical type. Allegro does not only that though, but
On Thursday 08 August 2002 20:16, Jason Winnebeck wrote:
> No it's not standard to do that. I personally would consider that
> bad programming practice to define a function for a class outside the
> class, rather than as a method.
This is not the case. When operating on classes with a binary operator,
for instance the '+' operator, it is necessary to use a function
outside either class. This is because class A doesn't have to know
about class B, and class B doesn't have to know about class A, but it
would be nice to add them if, for example, class A represents a speed
in ms^-1 and class B represents a speed in kph.
Eric's solution is the correct one.
Bye for now,
- --
Laurence Withers, lwithers@xxxxxxxxxx
(GnuPG 04A646EA) http://www.lwithers.demon.co.uk/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE9Uvh+UdhclgSmRuoRAq9tAJ426lBxoeOhPDz8RHJnjeU8MXOspwCeOVpt
QUAYoLHpETDl55iQbKaLM0Q=
=9KKm
-----END PGP SIGNATURE-----