473,385 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

No appropriate default constructor

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
4 2706
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
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: A | last post by:
Hi, A default copy constructor is created for you when you don't specify one yourself. In such case, the default copy constructor will simply do a bitwise copy for primitives (including...
4
by: Duy Lam | last post by:
The compiler is complaining about "no appropriate default constructor available" when I reference a subclass. The basic setup is that i have a class Test and a subclass called TestKid. I want to...
18
by: Matt | last post by:
I try to compare the default constructor in Java and C++. In C++, a default constructor has one of the two meansings 1) a constructor has ZERO parameter Student() { //etc... } 2) a...
5
by: Ook | last post by:
Here is my code, can some kind soul tell me what I'm doing wrong, or why I get this compile error, and maybe what to do to prevent it? I think I must be missing some fundamental concept here, or...
3
by: Stanislav Simicek | last post by:
Hello, I'm trying to implement "Null-Field" feature (like Stream::Null) in MC++, but I am not able to initialize static member properly due to compiler error C2512 (no appropriate default...
0
by: WithPit | last post by:
I have some problems with the instantiating new objects. For example I have the following code //Headerfile (Texture1D.h> #pragma once #using <mscorlib.dll> #include <osg/Texture1D> #include...
3
by: denis_browne | last post by:
When writing the following code: class Base { Base(const Base &rhs) {} ~Base(); }; void f() { Base b;
74
by: Zytan | last post by:
I have a struct constructor to initialize all of my private (or public readonly) fields. There still exists the default constructor that sets them all to zero. Is there a way to remove the...
4
by: Jess | last post by:
Hello, I tried several books to find out the details of object initialization. Unfortunately, I'm still confused by two specific concepts, namely default-initialization and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.