struct inheritance need?

Kagamin spam at here.lot
Tue Dec 23 04:05:10 PST 2008


Weed Wrote:

> The problem is not in use templates.
> 
> Templates are implementing some of the functionality of 2 types of 
> structures matrices (normal and dynamic). But the structures do not 
> inherit, then to add functionality matrix to other entities ( "pixel", 
> "image" etc) sites will have their list in a template return type.

If structs don't suit you, don't use them. Classes are better suited for OOP as I said long ago and continue repeating it over and over.

> It contain list of all types (MatrixT and VectorT) for return. Will it 
> add types of "image" and "pixel" and still others if needed. This is as 
> good as manually implement a new object model.

I'm sure any properly formalized problem is solvable. All you need is proper formalization and some design work.

> It is not necessary to suggest to wrap up "pixel" in a class - then it 
> too cannot be initialized in a compile time.

Sure it can't. Does it cause that big problems?


More information about the Digitalmars-d-learn mailing list