Thread: Matrix Class

  1. #1
    Registered User
    Join Date
    Dec 2014
    Posts
    143

    Matrix Class

    So I want to write a matrix class as a way of learning a good portion of C++. I know a good amount about programming and I know some of C++. What are some ideas on things I should keep in mind or research when using a matrix class. I know I want to use class templates and I know a little about them but I came across one question. Let's say I have an <int> matrix and a <float> matrix and I add them I will get a <float> array/matrix but I also want it to return a <float> array/matrix if I add a <float> matrix and an <int> matrix. Does that make sense?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    *moved to C++ programming forum*

    Quote Originally Posted by cmajor28
    Let's say I have an <int> matrix and a <float> matrix and I add them I will get a <float> array/matrix but I also want it to return a <float> array/matrix if I add a <float> matrix and an <int> matrix.
    Perhaps you could overload the relevant functions/operators for the specialised class templates.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-19-2014, 07:32 PM
  2. matrix class without STL
    By Avraham in forum C++ Programming
    Replies: 1
    Last Post: 04-29-2009, 05:41 AM
  3. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 01:03 AM
  4. Matrix Class & more...
    By Trauts in forum C++ Programming
    Replies: 10
    Last Post: 11-26-2002, 04:59 PM
  5. matrix class
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 10-28-2001, 04:57 PM