Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > a class that does not have a default constructor

Reply
Thread Tools

a class that does not have a default constructor

 
 
asdf
Guest
Posts: n/a
 
      10-02-2006
what does it mean? Could you please show me an example ?

For a class without a default constructor,how to initialize ?

 
Reply With Quote
 
 
 
 
benben
Guest
Posts: n/a
 
      10-02-2006
asdf wrote:
> what does it mean? Could you please show me an example ?
>
> For a class without a default constructor,how to initialize ?
>



class C
{
public: C(int i){}
};

C c1; // error
C c2(1234); // Ok

Ben
 
Reply With Quote
 
 
 
 
asdf
Guest
Posts: n/a
 
      10-02-2006
thanks.
benben wrote:
> asdf wrote:
> > what does it mean? Could you please show me an example ?
> >
> > For a class without a default constructor,how to initialize ?
> >

>
>
> class C
> {
> public: C(int i){}
> };
>
> C c1; // error
> C c2(1234); // Ok
>
> Ben


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
A constructor calling another constructor (default constructor)? Generic Usenet Account C++ 10 11-28-2007 04:12 AM
Calling base class constructor from derived class Copy constructor ali C++ 4 03-05-2007 09:15 AM
How to call default constructor from other constructor of the same class? romayankin@gmail.com C++ 9 03-06-2006 09:30 PM
Invoking templatized base class constructor from templatized derived class constructor mrstephengross C++ 5 05-18-2005 07:12 PM



Advertisments