Article View: be.comp.programming
Article #4599scope probleem (denk ik) in vc++
From: Harbinger of Doom
Date: Tue, 15 Jul 2003 18:55
Date: Tue, 15 Jul 2003 18:55
48 lines
2635 bytes
2635 bytes
Sorry voor de engelse tekst,
maar kheb dit berichtje in verschillende nieuwsgroepen gepost
en kben vanavond te lui om het naar 't nederlands
te vertalen!
I am currently working on an OO-program.
In that program, I have (among others) two classes,
called "NodeHttpConnection" and "Node"
There are memberfunctions of Node that
use a NodeHttpConnection object.
now, for my problem:
this listing works fine
void Node::connect()
{
NodeHttpConnection connection; //init connection
connection.setIP(this->getIPString()); //set IP
connection.setPort(this->getPort()); //set port
connected = connection.connect(); //try to connect (connected is a
//BOOL with class-scope)
}
yet when I declare 'connection' in the class definition of 'Node' (instead
of in the Node::connect() function)
so that it would have class-scope,
I get compile errors whenever I use a Node object.
i.e.
Node nod;
nod = someObject.someFunction(); //someObject.someFunction() returns a
Node object.
things like this give a compiler error saying that there is no
copy-constructor available for the Node-class.
it is true that I don't have a copy-constructor for the Node-class, but it's
strange that
the compiler creates one automatically if 'connection' is declared within
Node::connect()
and doesn't create one when 'connection' is declared in the class-definition
of the Node class.
Any Sugestions?
--
Harbinger Of Doom
Technical Details
Message-ID:
<A6YQa.12562$x86.1129888907@hestia.telenet-ops.be>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.vmunix.org!aotearoa.belnet.be!news.belnet.be!ossa.telenet-ops.be!hestia.telenet-ops.be.POSTED!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcea4,95543aa8161eaaf9,start X-Google-Attributes: gidfcea4,public X-Google-ArrivalTime: 2003-07-15 12:08:11 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.vmunix.org!aotearoa.belnet.be!news.belnet.be!ossa.telenet-ops.be!hestia.telenet-ops.be.POSTED!not-for-mail From: "Harbinger of Doom" <slavearc@pandora.be> Newsgroups: be.comp.programming Subject: scope probleem (denk ik) in vc++ Lines: 50 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: <A6YQa.12562$x86.1129888907@hestia.telenet-ops.be> Date: Tue, 15 Jul 2003 18:55:28 GMT NNTP-Posting-Host: 213.224.116.68 X-Complaints-To: abuse@telenet.be X-Trace: hestia.telenet-ops.be 1058295328 213.224.116.68 (Tue, 15 Jul 2003 20:55:28 CEST) NNTP-Posting-Date: Tue, 15 Jul 2003 20:55:28 CEST Organization: Telenet Internet