Search:

Type: Posts; User: thracian

Search: Search took 0.00 seconds.

  1. Replies
    22
    Views
    3,116

    Ah, thanks guys.

    Ah, thanks guys.
  2. Replies
    22
    Views
    3,116

    So with my example is the reference some random...

    So with my example is the reference some random memory location or where the destroyed variable used to exist? If it's where it used to exist, why isn't func(x)=1?
  3. Replies
    22
    Views
    3,116

    There are instances in my book where the...

    There are instances in my book where the reference operator follows the return type and not the arguement type which is the source of this confusion.
  4. Replies
    22
    Views
    3,116

    #include using namespace std; ...

    #include <iostream>
    using namespace std;


    int& func(int a){ return a;}

    int main(){

    int x =1;
  5. Replies
    22
    Views
    3,116

    ahh, crap, i actually already understood the pass...

    ahh, crap, i actually already understood the pass by reference idea, i just got it mixed up with the return type syntax. sorry about that.

    let me ask a different question:
    what type of variable...
  6. Replies
    22
    Views
    3,116

    what do you mean by reference? isn't a pointer a...

    what do you mean by reference? isn't a pointer a reference?
  7. Replies
    22
    Views
    3,116

    reference operator following return type?

    for example

    int& func(int& a);

    i keep seeing it in my book and it assumes you already know what it does, so it must be something basic. What does it do?

    edit:
  8. Replies
    12
    Views
    2,998

    ohhh! cvector was also the return type,...

    ohhh! cvector was also the return type, goddamnit, i completely missed that the first time.

    int - return type
    cvector- class
    taxecab_distance - member function


    thanks man
  9. Replies
    12
    Views
    2,998

    Ah, well I guess it makes sense now. Oh, and...

    Ah, well I guess it makes sense now. Oh, and yeah, that's what I meant for the first part(b.x=1, and b.y=2), sorry for not making it clearer.

    still trying to understand why cvector is repeated so...
  10. Replies
    12
    Views
    2,998

    When the constructor is called for the a and b...

    When the constructor is called for the a and b objects:
    CVector a (3,1);
    CVector b (1,2);

    a.x is assigned as 3 and a.y=1 as well as for b?



    but then when this is called:
  11. Replies
    12
    Views
    2,998

    the b object comes after the operator, i don't...

    the b object comes after the operator, i don't understand what you mean....


    in the case of the example, the operator+ is called implicitly with the + sign? i still don't understand what...
  12. Replies
    12
    Views
    2,998

    So then what is the arguement that is sent, or...

    So then what is the arguement that is sent, or 'param'?
  13. Replies
    12
    Views
    2,998

    All right, so then what calls the overloaded...

    All right, so then what calls the overloaded function?
  14. Replies
    12
    Views
    2,998

    overloading operators

    this code is frustrating me; it's an example from cplusplus.com(classes II)

    i can't differentiate between which members are the constructors, why the overloading function is even called, and why...
Results 1 to 14 of 14