Hi,
I am trying to create a programe like this:
n1 = NAttrib()
n2 = NAttrib()
out = NAttrib()
NAttrib class can be considered as general purpose attribute.
f1 = FloatAttrib(1.0)
f2 = FloatAttrib(2.0)
FloatAttribute class is like float type but with some extra spices. It has operator overloading functions such as add, multiply etc.
c1 = ComplexAttrib(arguments)
c2 = ComplexAttrib(arguments)
ComplexAttrib is a custom data type. It has operator overloading functions such as add, multiply etc.
n1.Set(f1)
n2.Set(f2)
Here we are setting FloatAttribute instances in our general purpose attribute.
out = n1 + n2
This should call add operator function defined in FloatAttribute class & out should become FloatAttribute
n1.Set(c1)
n2.Set(c2)
Here we are setting ComplexAttribute instances in our general purpose attribute.
out = n1 + n2
This should call add operator function defined in ComplexAttribute class & out should become ComplexAttribute
I am reading couple of books and also googling but still I am not sure how do I implement.
How to create NAttrib, FloatAttribute and ComplexAttribute class?
I am not sure but Template Class could be a solution?
Cheers