|
use a forward declaration of class B.
class B;
class A
{
public:
B GetB() {
...
}
class B
{
A GetA () {
...
}
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
At the point where you define class A compiler knows nothing about identifier B, that's why error occurs. Put this before declaration of A:
class B;
Now compiler knows that B is a class, but that's not all. To return B from function compiler must know declaration of B, so you have to return pointer to B, not object B(when compiler see pointer to class, it doesn't have to know declaration of this class). Also you can't call constructor of B at this point, so just declare function in a class A and make a definition after a declaration of class B.
Greetings
Mariusz Popiolek
|
|
|
|
|
LOL!
It's like a whole class full raising their
hands all at once 'cause it's one of the
answers everyone has just waiting for an
opportunity to get out.
|
|
|
|
|
Yeah well, what can I say. It was an easy question and I need to get my post count up a little
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
When I have seen this question there wasn't any answers, but when I finished answering the post(I tried the code in VC to be sure if it's working), there was already plenty of answers .
Greetings
Mariusz Popiolek
|
|
|
|
|
To avoid this error, you can 'forward declare' class B.
class B;
class A
{
public:
B GetB() { return B(); }
};
class B
{
public:
A GetA() { return A(); }
};
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
|
I have listctrl with rows(vary) and 3 column
let say first column is a,second is b, third is c;
I want the data of a, b, and c of the row.
so i tried the following ways
<br />
for(int i=0;i<numberOfRow;i++)
{<br />
CString dataA = myListCtrl.GetItemText(i,0);<br />
CString dataB = myListCtrl.GetItemText(i,1);<br />
CString dataC = myListCtrl.GetItemText(i,2);<br />
<br />
LV_ITEM lvitem;<br />
ZeroMemory(&lvitem, sizeof(lvitem));<br />
lvitem.mask = LVIF_TEXT | LVIF_STATE;<br />
lvitem.iItem = nIndex[i]; <br />
lvitem.iSubItem = 1; <br />
myListCtrl.GetItem(&lvitem); <br />
<br />
dataA = lvitem.pszText;<br />
}<br />
both ways gave me let say dataA value as junk. How can I get back my item text???
Thanks
|
|
|
|
|
Can't say why the first way is failing, but the second doesn't work because you're not providing a buffer for the control to store the text in. You need to set pszText and cchTextMax to the address and size of the buffer before calling GetItem().
--Mike--
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
let me try
Thanks Michael
|
|
|
|
|
If theres a problem with file strFile0 and an exception is thrown, I want the error message to have the name of the faulty file. This name is gotten in the try block. I dont think I can pass it in the catch argument:
catch(CFileException e, strFile0)
{
CString temp;
temp.Format("Error opening file : %d", e.m_cause);
AfxMessageBox(temp);
return -1;
}
}
So how do I communicate it to my messagebox in the catch block?
Appreciate your help,
ns
|
|
|
|
|
catch(CFileException e, strFile0)
{
CString temp;
temp.Format("Error opening file : %d ", e.m_cause);
AfxMessageBox(temp + e.m_strFileName);
return -1;
}
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thats convenient! You did however mean to remove the strFile0 argument I was trying to pass in, right ? I am off to look up CFileException and see what all it exposes...
Many thanks,
Appreciate your help,
ns
|
|
|
|
|
Yeah that way, i mean if u correct ur own mistakes u wont ever make them again For ur own good (ok, i forgot )
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
CFileException has m_strFileName member which contains file name.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
Is it possible to perform development in Visual Studio by having the libraries of a third-party component on a remote machine?
Any suggestions?!
|
|
|
|
|
Aehm, add the path to the library folder on the remote machine to your LIB path?
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
I have read data from a database into memory using a dinamic linked list in an SDI appication. Now I want to display the data, but I am having trouble doing so.
|
|
|
|
|
http://www.codeproject.com/library/gridprojects.asp
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hello,
If an ostream is open and a write operation completed, then a flush called, is the data 100% committed to disk or is there a delay?
Cheers,
Davy
Weblog, Ramblings and more...
www.latedecember.com
|
|
|
|
|
The data is 100% commited to disk.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
While stream flushes *its own* buffer, the OS can cache the data. Is there any requirement on standard file streams which makes them call API like ::FlushFileBuffers on close? I did quick grep and was unable to find fflush/_commit/FlushFileBuffer calls in C runtime sources for fstream.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
flushing an iostream causes a call to sync for the managed streambuf object. Dinkumware's doc for basic_filebuf (here[^]) state that basic_filebuf::sync calls in turn to fflush . Of course, the ultimate test is to check it directly on the source code, but alas I don't have my Visual Studio handy right now.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
can anybody plz help me with locking the PC ...thru Bios or any other way so that nobody can access it...It should not detect any Hard Disk. (dont tell me bios password since it can be cracked with jumper settings). I need to lock a PC anyhow bcoz when i go away to home from my PC somebody else come and start working on that.
If I change Windows 2000 password then they will format the Hard Disk and start working again.
IF I keep a BIOS password then they can crack it by changing jumper settings.
what i need that computer should be hanged and nobody can easily guess that what might have happened to the computer...why it was not working?
|
|
|
|
|
Sounds fishy....
How exactly would you restore the computer so that 'you could start working again'?
|
|
|
|