Hi,
This is my first post and I am learning c++. I am trying to create a programe like this:
1 2 3
|
n1 = NAttrib()
n2 = NAttrib()
out = NAttrib()
|
NAttrib class can be considered as general purpose attribute.
1 2
|
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.
1 2
|
c1 = ComplexAttrib(arguments)
c2 = ComplexAttrib(arguments)
|
ComplexAttrib is a custom data type. It has operator overloading functions such as add, multiply etc.
Here we are setting
FloatAttribute instances in out general purpose attribute.
out = n1 + n2
This should call add operator function defined in
FloatAttribute class &
out should become
FloatAttribute
Here we are setting
ComplexAttribute instances in out 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