By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,445 Members | 1,329 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,445 IT Pros & Developers. It's quick & easy.

No appropriate default constructor

P: n/a
Here's what I've got, essentially:

main()
{
class derClassA *dCA;
dCA = new(derClassA);
}

class derClassA
{
public:
derClassA(void);
....
}

derClassA::derClassA(void)
{
}
....

Try to compile, I get "No appropriate default constructor".

Any thoughts?

Thx.

LHC

Oct 31 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
NoNickName wrote:
Here's what I've got, essentially:
I would suggest posting what you have exactly. Somewhere in going from
what you have exactly to to what you have 'essentially' you have lost
the cause of your error.

Some errors below but I don't think any of these are the problem you are
complaining about.

main()
int main()
{
class derClassA *dCA;
derClassA* dCA;
dCA = new(derClassA);
dCA = new derClassA;
}

class derClassA
{
public:
derClassA(void);
derClassA();
...
}
};

derClassA::derClassA(void)
derClassA::derClassA()
{
}
...

Try to compile, I get "No appropriate default constructor".

Any thoughts?


Yes, post the real code.

john
Oct 31 '05 #2

P: n/a
dCA = new(derClassA);

dCA = new derClassA;


I suppose that could be the cause. Superfluous brackets are allowed in
many contexts in C++ but maybe not that one.

john
Oct 31 '05 #3

P: n/a
I'll check out your suggestion(s) and if I still can't get it I'll post
the real stuff.

Thx, LHC

Oct 31 '05 #4

P: n/a
"NoNickName" <us********@aol.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I'll check out your suggestion(s) and if I still can't get it I'll post
the real stuff.

Thx, LHC


And if you actually declared your class after main, that could be a problem
also. Declare them before main so the compiler knows what they are before
they're used.
Nov 1 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.