For my own use, I'd like to develop a small Vector and a Matrix class, independent of some big libraries that exist out there.
My question is:
Should Vector and Matrix stay two independent entities or should I derive a Vctor frm a Matrix or a Matrix from a Vector?
Any response is as always greatly appreciated. :)
ddanbe 2,724
Professional Procrastinator Featured Poster
Recommended Answers
Jump to PostI don't know anything about those objects but my tip would be to consider the Liskov substitution principle in making your decision.
Jump to PostHmm. Of the top of my head, I'd say it really depends on what features you plan to support. If there's a huge amount of intersection between the two, I might choose to implement the vector as a composition/specialization of a matrix of 1xN or Nx1. Alternatively, a matrix may …
All 9 Replies
DaveAmour 160
Mmmmmm beer Featured Poster
ddanbe
commented:
Thanks for the tip. +15
deceptikon 1,790
Code Sniper Team Colleague Featured Poster
ddanbe
commented:
Great help. +15
ddanbe 2,724
Professional Procrastinator Featured Poster
DaveAmour 160
Mmmmmm beer Featured Poster
JamesCherrill 4,733
Most Valuable Poster Team Colleague Featured Poster
ddanbe
commented:
Thanks for your tip! +15
ddanbe 2,724
Professional Procrastinator Featured Poster
mike_2000_17 2,669
21st Century Viking Team Colleague Featured Poster
ddanbe
commented:
You make me happy! +15
JamesCherrill
commented:
Outstanding contribution. +15
ddanbe 2,724
Professional Procrastinator Featured Poster
mike_2000_17 2,669
21st Century Viking Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.