Results 1 to 10 of 14

Thread: [C] The lousy random question thread

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    not having a compiler atm xD

    (edited the question above)


    EDIT:
    http://www.compileonline.com/compile_cpp_online.php
    main.cpp:21:10: error: 'void myClass::foobar(float)' cannot be overloaded
    main.cpp:14:13: error: with 'myClass myClass::foobar(float)'
    Code:
    #include <iostream>
    
    bool foobar( float x )
    {
        std::cout << "" << std::endl;
        return true;
    }
    
    class myClass
    {
        public:
    
        myClass foobar( float x )
        {
            std::cout << "myClass foobar()" << std::endl;
    
            return myClass();
        }
    
        void foobar( float x )
        {
            std::cout << "void foobar()" << std::endl;
    
        }
    };
    
    int main( int argC , char* args[] )
    {
        myClass c1 , c2 , c3;
    
        foobar( 0.0f );
        c1.foobar( 0.0f );
        c2 = c3.foobar( 0.0f );
    }
    Last edited by serthy; 2nd August 2013 at 21:13.

  2. The Following User Says Thank You to serthy For This Useful Post:

    kung foo man (2nd August 2013)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •