Results 1 to 4 of 4

Thread: optional parameters (without overriding)

  1. #1

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919

    optional parameters (without overriding)

    is there a way to do it without having to override the function?
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  2. #2
    Zaei
    Guest
    In a prototype:
    Code:
    void func(int x=0);
    x's default value will be 0. the actual function definition might look like this:
    Code:
    void func(int x)
    {
        cout << x << endl;
    }
    Note the lack of the =0. If you dont have the prototype, then you DO need to ad the =0 though.

    Z.

  3. #3

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    i have to have a prototype?

    cant just do

    void test(int num=0){
    //blah blah
    }
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  4. #4
    Zaei
    Guest
    You dont have to have the prototype, but f you do, only have the =0 in that prototype.

    Z.

Posting Permissions

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



Click Here to Expand Forum to Full Width