Sei sulla pagina 1di 1

ENS213Programming for Engineers

Lab 11: Constructors and Operator Overloading


WEEK 11
General information about ENS 213 lab:
ENS 213lab will be held every Tuesday from 09:00-11:00. The lab will be done in C++
programming language. All lab-work must be completed during the lab-time, and will
accordingly be graded during the lab. For any question/comments, you may contact me at
ehodzic@student.ius.edu.ba or come to my office (F1.36) during consultation hours. You may
also visit my blog, where I will occasionally put C++ related materials at
http://emirhodzicblog.wordpress.com

_____________________________________________________________________

TASK 1

Write a class CustomMatrix that will have the following:


- three member variables: double pointer, number of rows and number of
columns
- two constructors empty constructor, constructor which will allocate
amount of memory needed
- void setCustomMatrix(); - This function should allow user to populate the
matrix
- void displayCustomMatrix();- This function should display the matrix
- You need to overload + operator so it is possible to add matrices (e.g. c =
a + b)
- You need to overload * operator so it is possible to multiply matrix with
constant

Potrebbero piacerti anche