Search:

Type: Posts; User: dslowik

Search: Search took 0.00 seconds.

  1. Replies
    5
    Views
    929

    Actually, it would be easier to allow the even...

    Actually, it would be easier to allow the even messier friendship of declaring the entire class B to be a friend of class A. That would only require a forward declaration of class B prior to the...
  2. Replies
    5
    Views
    929

    Yes, that is a better solution, e.g, define a...

    Yes, that is a better solution, e.g, define a public:
    int get_deg() const { return _i; } method for class A. At this point, I'm just using this code to study about dependencies in class...
  3. Replies
    5
    Views
    929

    Yes, that exposes the name A so that the B(const...

    Yes, that exposes the name A so that the B(const A &) ctor can be declared. I actually came across that solution after I posted my question.

    Then, in order to compile B.cpp, one must still...
  4. Replies
    5
    Views
    929

    circular header dependencies

    Here is a problem of circular dependency. I want to allow a class B ctor friend access to private members of a class A object. But in order to tell class A this, class A needs to know about the...
  5. Yes, I agree it would be more satisfying had they...

    Yes, I agree it would be more satisfying had they quoted the standard or gave a reason for that rule.

    Here is some reasoning:
    Those 'extern' variables are initialized before any function runs....
  6. A rule that causes that compiler error

    In 2.2.2. Variable Declarations and Definitions of c++ Primer 5th ed Lippman et.al. I came across this rule:

    i.e. trying to define an external variable inside of a function is not allowed, which...
  7. Thread: References

    by dslowik
    Replies
    11
    Views
    2,042

    More fun with result passing

    The C++ Witch clearly explains how things are working related to the original code.

    Here is some more exploration on that last code snippet in the OP. Running the following code shows how both a...
  8. Replies
    4
    Views
    1,068

    Then you can use the std::hex manipulator on the...

    Then you can use the std::hex manipulator on the stream too.
  9. Replies
    6
    Views
    766

    Here is the result I got: El valor de i es 2...

    Here is the result I got:

    El valor de i es 2
    El valor de j es 0
    Which makes sense if you consider:
    Order of evaluation - cppreference.com
    6) Every value computation and side effect of the...
  10. Yes, I am coming around to that belief. I guess...

    Yes, I am coming around to that belief. I guess to really see how it is implemented would involve knowing more about how C/C++ is compiled to assembly, one of my next projects..
  11. reply to last post/reply

    Thanks for the reply.
    - Yes, I agree C does not have operator overloading. But that does not prevent the % operator from being defined as I indicated (even though it might not be.)
    - There is...
  12. So I see that I can't modify the built-in types...

    So I see that I can't modify the built-in types -to include not overloading any of their operators. But I'm thinking that the built-in type (in this case int) defines its' operator % as an operator%...
  13. How does modulo operator(%) avoid implicit float to int conversion?

    I know that the % operator does integer modulo.
    And that the following code does not compile:


    #include <iostream> using std::cout;

    int main() {
    int i = 5.3;
    double d = 4;
Results 1 to 13 of 13