P
pauldepstein
I am writing a program to calculate prices of commodity options as part
of my Masters degree in Finance. (Absolutely no prior knowledge of
computer programming was assumed.)
I am representing dates as integers. It's important to be able to
derive the month from the date so I have programmed this using mod 365
arithmetic.
I have several classes that use dates as private objects.
How do I set up my get_month function (which gives the month of any
date) so that different classes can all make use of it without me
needing to copy and paste the code separately in each class?
Yes, I know it's a standard problem...
Actually, it now occurs to me that I will probably simply have a date
class and have other classes contain a variable of the type date.
However, there still must be a way of building functions which work on
a variety of classes.
I suppose I'm really asking for a good classes_for_beginners tutorial
or website.
Thank you,
Paul Epstein
of my Masters degree in Finance. (Absolutely no prior knowledge of
computer programming was assumed.)
I am representing dates as integers. It's important to be able to
derive the month from the date so I have programmed this using mod 365
arithmetic.
I have several classes that use dates as private objects.
How do I set up my get_month function (which gives the month of any
date) so that different classes can all make use of it without me
needing to copy and paste the code separately in each class?
Yes, I know it's a standard problem...
Actually, it now occurs to me that I will probably simply have a date
class and have other classes contain a variable of the type date.
However, there still must be a way of building functions which work on
a variety of classes.
I suppose I'm really asking for a good classes_for_beginners tutorial
or website.
Thank you,
Paul Epstein