Click here to Skip to main content
15,916,683 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Google Login [modified] Pin
Laxman Auti6-Jun-06 20:00
Laxman Auti6-Jun-06 20:00 
GeneralRe: Google Login [modified] Pin
Rahul.RK6-Jun-06 20:10
Rahul.RK6-Jun-06 20:10 
GeneralRe: Google Login [modified] Pin
Laxman Auti6-Jun-06 20:20
Laxman Auti6-Jun-06 20:20 
GeneralRe: Google Login [modified] Pin
Rahul.RK6-Jun-06 20:23
Rahul.RK6-Jun-06 20:23 
QuestionHow to display 2 sheets in Excel Pin
MikeRT6-Jun-06 19:25
MikeRT6-Jun-06 19:25 
AnswerRe: How to display 2 sheets in Excel Pin
FarPointer6-Jun-06 19:48
FarPointer6-Jun-06 19:48 
GeneralRe: How to display 2 sheets in Excel Pin
MikeRT6-Jun-06 20:02
MikeRT6-Jun-06 20:02 
GeneralRe: How to display 2 sheets in Excel Pin
FarPointer6-Jun-06 20:12
FarPointer6-Jun-06 20:12 
GeneralRe: How to display 2 sheets in Excel Pin
MikeRT6-Jun-06 20:36
MikeRT6-Jun-06 20:36 
QuestionText file stream? Pin
supernalle6-Jun-06 19:16
supernalle6-Jun-06 19:16 
Questionask for suggestion Pin
cheng_guo6-Jun-06 19:00
cheng_guo6-Jun-06 19:00 
AnswerRe: ask for suggestion Pin
_AnsHUMAN_ 6-Jun-06 19:11
_AnsHUMAN_ 6-Jun-06 19:11 
GeneralRe: ask for suggestion Pin
cheng_guo7-Jun-06 5:24
cheng_guo7-Jun-06 5:24 
QuestionRe: ask for suggestion Pin
Hamid_RT6-Jun-06 19:33
Hamid_RT6-Jun-06 19:33 
QuestionWhich interface can I use to set background-repeat property? Pin
Tcpip20056-Jun-06 18:55
Tcpip20056-Jun-06 18:55 
AnswerRe: Which interface can I use to set background-repeat property? Pin
Tcpip20056-Jun-06 21:48
Tcpip20056-Jun-06 21:48 
QuestionAdding const won't compile Pin
MALDATA6-Jun-06 18:48
MALDATA6-Jun-06 18:48 
I'm trying to learn C++, so I'm just building some sample classes to get some experience. I have a matrix class in which I have implemented an addition operator that looks like this...

matrix operator + (matrix& toAdd)
{
// Create a zero matrix to output.
matrix output = matrix(toAdd.get_rows(), toAdd.get_cols(), 0);

// A temporary variable for the sum of each element
double val;

// Go through every element and add them together
// Stick the result in the output matrix
for(int i = 0; i < nrows; i++)
{
for(int j = 0; j < ncols; j++)
{
// The array indices are always 1 less
// than the row or column number
val = elements[i][j] + toAdd.get_el(i+1,j+1);
output.set_el(i+1, j+1, val);
}
}
return output;
}

It's nothing fancy... hopefully you won't need to see the whole class to understand the problem.

I wanted to pass it a matrix by reference in case the matrix is huge. I figure it'd probably be good form to add a const so that it is

matrix operator + (const matrix& toAdd)

but if I add that in, it doesn't compile. I get errors like

"passing 'const matrix' as 'this' argument of 'int matrix::get_rows()' discards qualifiers"

I get one of those errors for every time I use a member function of toAdd. Without const, everything's fine, but the matrix referred to as toAdd is vulnerable to changes. I am using gcc (or, more accurately, g++) to compile. Let me know if you need more information. Thanks!

-Mark
AnswerRe: Adding const won't compile Pin
sunit56-Jun-06 19:09
sunit56-Jun-06 19:09 
AnswerRe: Adding const won't compile Pin
toxcct6-Jun-06 22:00
toxcct6-Jun-06 22:00 
AnswerRe: Adding const won't compile Pin
Michael Dunn7-Jun-06 2:52
sitebuilderMichael Dunn7-Jun-06 2:52 
QuestionHow to clear the screen to recover to the old style Pin
xuwenq886-Jun-06 18:45
xuwenq886-Jun-06 18:45 
AnswerRe: How to clear the screen to recover to the old style Pin
Hamid_RT6-Jun-06 19:11
Hamid_RT6-Jun-06 19:11 
AnswerRe: How to clear the screen to recover to the old style [modified] Pin
Naveen6-Jun-06 21:50
Naveen6-Jun-06 21:50 
Generalbest book for VC++ beginners Pin
sach!!6-Jun-06 18:32
sach!!6-Jun-06 18:32 
GeneralRe: best book for VC++ beginners Pin
nicknotyet7-Jun-06 10:15
nicknotyet7-Jun-06 10:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.