PDA

View Full Version : defining number



mickey
1st February 2008, 02:07
Hello,
I was wondering if will be possible defining my own class Number and inherit from this class as Integer, Float......I write it, but I stopped yet. Class Number should contain in a such way the number. But what type? String? And then: I thought to do in Number some virtual method as Sum; but what type it will return and take Sum? Am I needing of template? I hope you understand the question........

marcel
1st February 2008, 06:19
Yes, you need a template.
As for complex numbers, typically all libraries have a separate for them.