"data" is of a generic type which does not support "==" operator in general.
In you case, you can constrain T to of interface type "IComparable<T>", thus you do any comparison by using...
Type: Posts; User: igoogleu
"data" is of a generic type which does not support "==" operator in general.
In you case, you can constrain T to of interface type "IComparable<T>", thus you do any comparison by using...
Thanks! That's what I did last night! I was thinking too much and forgot the simplest way. I don't need a reference to A.c if I just use property like that.
I don't know what was Mod doing? I posted it in C# section, and I am asking a C# question. Why move it to C++ section?
Currently I wrote a property "c" to return the value of .Count, but I have to add c= .Count everywhere .Count changes, right?
well, by "frequent" I mean I will manipulate A in many methods of B now and in the future. Thus each time I write a method manipulating A, I have to add a line "c=A.b". If there is a way I can write...
Hi salem, that makes sense. Actually, I don't want to change the value A.b outside A bypassing A's public property or methods. What I want is letting c be a read-only alias of A.b.
public class...
I have one class A which has an "int" field b; I defined another int type variable c. When I make any changes to A.b, I want c changes accordingly such that c=A.b .
One can always add a line c=A.b...
I followed Daved and vart's suggestions to modify the get() function. Then it is ok.
This forum is really quickly-replied and informed. Thanks all replies.
Sorry, the code is a little bit longer and the varibles are not well named because the author wants to make the code short.
Thanks for replying. I tried add std:: , but I still get some other errors. The code is posted here. I thought the main problem is with the istream class.
The compile error is shown as the...
When I compile some old source code downloaded from Internet, I sometimes encounter the problems with
#include <fstream.h>
#include <iostream.h>
The g++ compiler in cygwin claims the...