Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 1,000 results for
operator<<
- Page 1
Re: operator()
Programming
Software Development
18 Years Ago
by Rashakil Fol
…string greeting_text; int
operator
()(const std::string& greetee) { std::cout &
lt
;&
lt
; greeting_text &
lt
;&
lt
; ", " &
lt
;&
lt
; greetee &
lt
;&
lt
; "!" &
lt
;&
lt
; std::endl;… world!" std::cout &
lt
;&
lt
; x &
lt
;&
lt
; std::endl; // outputs 12345 [/code] Generally speaking,
operator
() tries to provide the ability …
Re: += operator - Cannot get this to return correct value to application
Programming
Software Development
15 Years Ago
by Banfa
… the object it is called on, unlike the binary additional
operator
operator
+ which does not alter the object it is called on… of x and y. You need to re-write your
operator
+= so that is does an in place calculation, that is…
Re: Operator Overloading issue
Programming
Software Development
15 Years Ago
by Banfa
operator
+ is not in any way dependent on having any sort … this form (for a general type T) [code] T T::
operator
+(const T& rhs) { return T(*this) += rhs; } [/code] Which… having a copy constructor and an
operator
+=. However you do not have to implement your
operator
+ like this you can just implement…
Re: operator-
Programming
Software Development
17 Years Ago
by ShawnCplus
… meaningful variable names. [inlinecode]friend zz
operator
-(zz z);[/inlinecode] Secondly, the -
operator
is a binary
operator
. It accepts two operands, the left… pointer. So which are you trying to accomplish, the binary
operator
( [inlinecode]a-b[/inlinecode]) or the unary…
operator-
Programming
Software Development
17 Years Ago
by tnvkrishna
… : string s; //constructor private: friend zz
operator
-(zz z); //assume definition of
operator
&
lt
;&
lt
; }; //constructor //
operator
&
lt
;&
lt
; zz
operator
-(zz z) { string s; s=z.s… zz(s); } int main() { zz a("fsd"); cout&
lt
;&
lt
;(-a); } [/code] i am new to c++ but just enthusiastic
Re: operator-
Programming
Software Development
17 Years Ago
by Duoas
The code [inlinecode]-a[/inlinecode] is a unary
operator
, so he isn't trying to do anything weird. The argument to your
operator
function should be a reference: [inlinecode]zz
operator
- ( zz &z )[/inlinecode] Otherwise it looks fine.
Re: [][] operator?
Programming
Software Development
15 Years Ago
by Narue
Obviously you can't overload the [][]
operator
because no such
operator
exists. What you need to do for your MatrixClass class is overload the []
operator
to return another type that also overloads the []
operator
.
Re: operator()
Programming
Software Development
18 Years Ago
by Nick Evan
You can use
operator
() to overload operators... ok, say you've got a rectangle(… 2; The compiler will be very sad. If you make
operator
-overloading in your class, you can tell the compiler what…. I don't have a concrete example, but google for
operator
-overloading.
operator()
Programming
Software Development
18 Years Ago
by disc
…] [COLOR=#0000ff]bool[/COLOR][COLOR=#000000] MyClass::[/COLOR][COLOR=#0000ff]
operator
[/COLOR][COLOR=#000000]()()[/COLOR] [COLOR=#000000]{ [/COLOR] [COLOR=#000000] ....[/COLOR…] [COLOR=#0000ff]virtual[/COLOR] [COLOR=#0000ff]bool[/COLOR] [COLOR=#0000ff]
operator
[/COLOR]()(); } [/code]
Re: operator()
Programming
Software Development
18 Years Ago
by Nick Evan
… #include &
lt
;iostream> using namespace std; class CVector { public: int x,y; CVector () {}; CVector (int,int); CVector
operator
+ (CVector…int b) { x = a; y = b; } CVector CVector::
operator
+ (CVector param) { CVector temp; temp.x = x + param.x… CVector c; c = a + b; cout &
lt
;&
lt
; c.x &
lt
;&
lt
; "," &
lt
;&
lt
; c.y; return 0; } [/code]
Re: operator()
Programming
Software Development
18 Years Ago
by disc
I already googled for
operator
overloading. Most of them I understand but not this specific one,
operator
().
[][] operator?
Programming
Software Development
15 Years Ago
by daviddoria
…,i; [/code] You can make an accessor like: [code] double
operator
[](int index) { if(index == 0) return a; else if(index…] But how would you do something like this: [code] double
operator
[][](int rindex, int cindex) { if(rindex == 0 && cindex…
operator << >>
Programming
Software Development
15 Years Ago
by xzero_x
… will correct a C++ program that has errors in which
operator
, &
lt
;&
lt
; or >>, it uses with cin and cout.… The program replaces each (incorrect) occurrence of cin&
lt
;&
lt
; With the corrected version cin>> And each (…one blank between the cin and cout and the following
operator
. The program to be corrected is in one file …
; operator
Programming
Software Development
14 Years Ago
by crapgarden
…++] = "armor"; inventory[numItems++] = "shield";[/CODE] the ++
operator
increments the array number of inventory AFTER it reaches the… ;
operator
? All POST operations are performed at the end of a …
operator
Programming
Software Development
12 Years Ago
by Abhinisha
what is the use of the dot
operator
(.) and ->
operator
?
Operator
Programming
Software Development
11 Years Ago
by Learner010
… doubt : is it possible to treat string value like a
operator
? for example : let suppose , there are 2 variable named `a… type named `opertor_type` of string type which will store the
operator
symbol. a=10 b=20 operator_type="+" and here…
Re: operator
Programming
Software Development
11 Years Ago
by Vincentas
These are meant to be member and pointer operators. "->" is a Structure dereference
operator
and "." is Member a pointer. But i doubt this will mean anything to you, I'd suggest you read a book on C++ or get some tutorials online. Vincentas
Re: Operator
Programming
Software Development
11 Years Ago
by ddanbe
What you are trying to do is indeed not possible. There is something like [
operator
overloading](http://msdn.microsoft.com/en-us/library/ms379613(v=vs.80).aspx), but it is rarely needed in every day use of VB, so I would not spoil my learning energy on it right now.
Re: Operator
Programming
Software Development
11 Years Ago
by Learner010
thanks for quick reply. i wanted to know to if there exist any other way to use strings as
operator
but i didn't find any useful that's why i created thread here and now i am sure that this is really very rare . thanks.
Operator for between?
Programming
Software Development
15 Years Ago
by Dasau
Hi I would like to know what
operator
to use for a number in between my input. Is it something like this? If I input the number between 116 and 200. [CODE]else if (Earn>=116)&&(Earn &
lt
;=200)[/CODE]
Operator Overloading and some math issues...
Programming
Software Development
14 Years Ago
by Syrne
…&); bool
operator
== (const Fraction&); bool
operator
!= (const Fraction&); Fraction
operator
> (const Fraction&); Fraction
operator
&
lt
; (const Fraction&); Fraction
operator
&
lt
;= (const…
Operator Insertion Overload C++ help, and errors
Programming
Software Development
14 Years Ago
by ana_1234
… in, MyInt& f); friend ostream&
operator
&
lt
;&
lt
;(ostream& out, MyInt& f); // ….integer2[count]; count++; }*/ return in; } ostream&
operator
&
lt
;&
lt
;(ostream& out, MyInt& f) { for(int i…z.NumberList[i] %= 10; return z; } } } bool
operator
&
lt
; (const MyInt& f1, const MyInt& f2) { …
Operator Overloading
Programming
Software Development
13 Years Ago
by lbgladson
… &
lt
;&
lt
; "+" &
lt
;&
lt
; z &
lt
;&
lt
; " = " &
lt
;&
lt
; x &
lt
;&
lt
; endl; // Test overloaded subtraction
operator
x = y - z; cout &
lt
;&
lt
; y &
lt
;&
lt
; " - " &
lt
;&
lt
; z &
lt
;&
lt
; " = " &
lt
;&
lt
…
Re: Operator Overloading
Programming
Software Development
13 Years Ago
by lbgladson
…(imaginaryPart) { } ostream&
operator
&
lt
;&
lt
;(ostream& output, const Complex& c) { output &
lt
;&
lt
; c.imaginary &
lt
;&
lt
; "+" &
lt
;&
lt
; c.real &
lt
;&
lt
; "i"…
Operator Overloading HELP!
Programming
Software Development
17 Years Ago
by balla4eva33
…(dist1 &
lt
; dist2) ... bool
operator
&
lt
; (Distance & d2) ; // ************************************** void getdist() //get length from user { cout &
lt
;&
lt
; "… true : false; } // used for if (dist1 &
lt
; dist2) ... bool Distance::
operator
&
lt
; (Distance & d2) { int b1 = feet …
Re: Operator Overloading and some math issues...
Programming
Software Development
14 Years Ago
by mrnutty
[CODE] Fraction Fraction ::
operator
* (const Fraction& fr2) { int numen = (numerator * fr2.[COLOR="Red"]numerator[/COLOR]); int denom = (denominator * fr2.denominator); return Fraction (numen, denom); // Trouble here } [/CODE]
Re: Operator Overloading and some math issues...
Programming
Software Development
14 Years Ago
by Syrne
[QUOTE=firstPerson;1407041][CODE] Fraction Fraction ::
operator
* (const Fraction& fr2) { int numen = (numerator * fr2.[COLOR="…
operator issues
Programming
Software Development
14 Years Ago
by MasterGberry
… &
operator
&
lt
;&
lt
;(std::ostream …
operator
&
lt
;&
lt
;(std::ostream & os, const Vector & v) { if (v.mode == 'r') os &
lt
;&
lt
; "(x,y) = (" &
lt
;&
lt
; v.x &
lt
;&
lt
…
operator
&
lt
;&
lt
;(std::ostream & os, const VectorMath & v) { os &
lt
;&
lt
; "Max is " &
lt
;&
lt
; v.max.magval() &
lt
;&
lt
; ", Min is " &
lt
;&
lt
…
Operator Overloading
Programming
Software Development
13 Years Ago
by DrShroom
… *
operator
RationalNumber
operator
/(RationalNumber&) ; //overload the /
operator
RationalNumber
operator
>(RationalNumber &); RationalNumber
operator
&
lt
;(RationalNumber &); RationalNumber
operator
>=(RationalNumber &); RationalNumber
operator
&
lt
;=(RationalNumber &); RationalNumber
operator
…
Re: Operator Overloading
Programming
Software Development
13 Years Ago
by lbgladson
…;; cout &
lt
;&
lt
; x; cout &
lt
;&
lt
; ") = ("; cout &
lt
;&
lt
; y; cout &
lt
;&
lt
; ") + ("; cout &
lt
;&
lt
; z; cout &
lt
;&
lt
; ")" &
lt
;&
lt
; endl; // Test overloaded subtraction
operator
x…
1
2
3
17
Next
Last
Search
Search
Forums
Forum Index
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
Backlink Auditor
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2025 DaniWeb® LLC