Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 6 : Introduction to Classes #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
added overload assignment operators
dhern023 committed Aug 11, 2021
commit 405e513e3ce4cd86ec3f530388514c192ee0479f
7 changes: 7 additions & 0 deletions scientific_computing/SquareMatrix.cpp
Original file line number Diff line number Diff line change
@@ -25,6 +25,13 @@ SquareMatrix::SquareMatrix(std::vector< std::vector< double>> A)

// Operators
//overload assignment operator
SquareMatrix& SquareMatrix::operator=(const SquareMatrix& square_matrix)
{
matrix = square_matrix.matrix;
size = square_matrix.size;
return *this;
}

//overload unary substraction operator
//overload binary add/substraction

2 changes: 1 addition & 1 deletion scientific_computing/SquareMatrix.h
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ class SquareMatrix
SquareMatrix(std::vector< std::vector< double>> A); //Pass in matrix to constructor

// Operators
//overload assignment operator
SquareMatrix& operator=(const SquareMatrix& square_matrix); //overload assignment operator
//overload unary substraction operator```
//overload binary add/substraction`