Results 1 to 10 of 10

Thread: Why C++ doesn't allow this?

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2001
    Posts
    396

    Question Why C++ doesn't allow this?

    Code:
    #include <iostream.h>
    #include <stdlib.h>
    
    class fourpoint
    {
       public:
       int w,x,y,z;
    
    
       fourpoint();
       fourpoint(int w,int x,int y,int z);
       ~fourpoint();
    
    
    
    
    } ;
    fourpoint::fourpoint()
    {
    
    }
    fourpoint::fourpoint(int w=0,int x=0,int y=0,int z=0)
    {
        this->w=w;
        this->x=x;
        this->y=y;
        this->z=z;
    
    
    }
    
    fourpoint::~fourpoint()
    {
    
    
    }
    
    
    
    int main()
    {
    
          fourpoint *sh= new fourpoint(40,40);
          cout<<endl<< sh->w <<" "<< sh->x;
          cout<< " "<< sh->y <<" "<< sh->z<<endl<<endl;
          system("PAUSE");
          return 0;
    }
    I can't do this

    fourpoint *sh= new fourpoint( , ,40,40);//error

    Looks like not very flexible to me as it allows no parameters for the back but it needs you to put parameters in front even though the value of front parameters is default.

    p.s. the above program doesn't do anything useful, it was written by me to test whether no front parameters works or not.
    Last edited by transcendental; Jan 2nd, 2002 at 08:03 PM.
    I'm a VB6 beginner.

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