-
C++ Template Class
Alright, I have an assignment in C++. I need to create a template class for imaginary expressions of the form a+bi and consider the following:
Default Constructor
Copy Constructor
Destructor
Assignment Operator
+=
*=
+
-
*,[(a+bi)*(c+di)=(ac-bd)+(ad+bc)i]
==
!=
<<
I want ot make sure I have the header and implementation for the class correct and to see how some other people would go about doing it. All necessary functions are already defined for the template class. I also want to know if any of the preceding don't need to be included in the class definition. Thanks in advance. I would also appreciate any links to C++ sites
-
Operators used in a templated, user-defined class must be overloaded.
>>I want ot make sure I have the header and implementation for
the class correct ...
It is normal for you to post an example of your code if you are
asking for assistance.
>> and to see how some other people would go about doing it.
Textbooks provide examples of class templates, but please post some code and someone will help you out.
-
Thanks for some response, I did overload the operators. I figured out most of the problem and will post some of the code later on today if I have time.