home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13387 < prev    next >
Encoding:
Text File  |  1992-09-08  |  1.8 KB  |  53 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!psgrain!hippo!shannon!concave.cs.wits.ac.za!wayne
  3. From: wayne@concave.cs.wits.ac.za (Wayne Smith)
  4. Subject: Parametrized Constructors
  5. Message-ID: <1992Sep8.133059.718@shannon.ee.wits.ac.za>
  6. Sender: news@shannon.ee.wits.ac.za
  7. Organization: Wits Univ. Computer Science Dept.
  8. Date: Tue, 8 Sep 1992 13:30:59 GMT
  9. Lines: 42
  10.  
  11. Hi,
  12.  
  13. I hope I not asking a simple question, but I would like to know the following:
  14.  
  15. I am using AT&T's c++ translator. I am trying to declare a pointer to a class that has a parametrized constructor as a member. e.g
  16.  
  17. class foo
  18.    {
  19.     ...
  20.     ...
  21. public:
  22.     foo(int s);
  23.     ...
  24.    };
  25.  
  26. when I declare:
  27.  
  28. foo *fooptr;
  29.  
  30. I get a translator message saying an integer parameter is expected. I tried adding a parameterless contructor to the class definition but it still complains. Another thing I am trying to do is declare an array of objects that take parametrized constructors e.g:
  31.  
  32. fooarray = new foo(2)[10];
  33.  
  34. apparantly this is not possible in c++, but  I need a conceptually decent workaround.
  35.  
  36. Does anyone have any solutions. Information would be much appreciated. Please reply to my email address. I will summarize and post.
  37.  
  38. Cheers,
  39. Wayne*********************************************************************
  40. * Wayne Smith                         (wayne@concave.cs.wits.ac.za) *   
  41. * University of the Witwatersrand      Phone (011) 716-3295         * 
  42. * Computer Sciece Department                                        *
  43. * P.O Box WITS                                                      *
  44. * Johannesburg                                                      *
  45. * 2050                                                              *
  46. * South Africa                                                      *
  47. *********************************************************************
  48.  
  49.  
  50.  
  51.  
  52.  
  53.