3 ms·
Well, yeah. Usually somewhere in there it'll have class Complex { double real; double imaginary; } Or similar. Maybe template it so yo
by taneq 10y ago
Well, yeah. Usually somewhere in there it'll have
class Complex {
double real;
double imaginary;
}
Or similar. Maybe template it so you can have a Complex<double> instead. It's still fundamentally a combination of existing types.
- goatlover 10y agoThat doesn't change the usefulness of being able to create new data types from existing ones. With operator overloading or operators as methods, you can treat user your new data types as primitives. That's very convenient when you want your complex numbers to work just like ints and floats.
- taneq 10y agoI didn't mean to say it's not useful, just that it's much simpler than actually defining a new primitive type, which is how I originally interpreted the term.