Click here to Skip to main content
16,004,924 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: ofstream question Pin
David Crow15-Aug-07 3:11
David Crow15-Aug-07 3:11 
QuestionCArray in a constructer Pin
ForNow14-Aug-07 22:54
ForNow14-Aug-07 22:54 
AnswerRe: CArray in a constructer Pin
jhwurmbach14-Aug-07 23:06
jhwurmbach14-Aug-07 23:06 
GeneralRe: CArray in a constructer Pin
ForNow14-Aug-07 23:25
ForNow14-Aug-07 23:25 
GeneralRe: CArray in a constructer Pin
jhwurmbach14-Aug-07 23:30
jhwurmbach14-Aug-07 23:30 
GeneralRe: CArray in a constructer Pin
ForNow14-Aug-07 23:40
ForNow14-Aug-07 23:40 
GeneralRe: CArray in a constructer Pin
ForNow15-Aug-07 6:26
ForNow15-Aug-07 6:26 
GeneralRe: CArray in a constructer Pin
jhwurmbach15-Aug-07 6:46
jhwurmbach15-Aug-07 6:46 
Let me put that into code:
You have
class A	{
	int dummy;
};

class B	{
B :: B( const CArray(A, &A)& Array)
: m_array( Array)
{
}

private:
  CArray(A, &A) m_array;
};

B myB;  //Would not compile

CArray(A, A&) arrA;
B myB( arrA); //would compile


Note that, as we have explicitly written a constructor, the compiler will not write another constructor for us - we must do this, if we need it.

Until now, B is neither derived from A nor from CArray(A). It contains a (private, not accessible from the outside) CArray(A).

So myB[3] is nonsensical - B is no array and does not have a operator[].

Until now, the only way the m_Array member-variable in B can be filled is at construction time (by providing a CArray(A)). And on the other hand, you can not construct a B without providing the CArray(A).



Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
George Orwell, "Keep the Aspidistra Flying", Opening words

GeneralRe: CArray in a constructer Pin
ForNow15-Aug-07 12:41
ForNow15-Aug-07 12:41 
GeneralRe: CArray in a constructer Pin
jhwurmbach15-Aug-07 21:32
jhwurmbach15-Aug-07 21:32 
GeneralRe: CArray in a constructer Pin
ForNow16-Aug-07 6:49
ForNow16-Aug-07 6:49 
GeneralRe: CArray in a constructer Pin
jhwurmbach16-Aug-07 6:56
jhwurmbach16-Aug-07 6:56 
GeneralRe: CArray in a constructer Pin
ForNow16-Aug-07 11:55
ForNow16-Aug-07 11:55 
GeneralRe: CArray in a constructer Pin
jhwurmbach16-Aug-07 21:34
jhwurmbach16-Aug-07 21:34 
GeneralRe: CArray in a constructer Pin
ForNow17-Aug-07 6:37
ForNow17-Aug-07 6:37 
QuestionSetting FTP Server Directory [modified] Pin
Programm3r14-Aug-07 19:50
Programm3r14-Aug-07 19:50 
AnswerRe: Setting FTP Server Directory Pin
Iain Clarke, Warrior Programmer15-Aug-07 0:55
Iain Clarke, Warrior Programmer15-Aug-07 0:55 
GeneralRe: Setting FTP Server Directory Pin
Programm3r15-Aug-07 2:09
Programm3r15-Aug-07 2:09 
QuestionUnlocking a folder Pin
indra2014-Aug-07 18:50
indra2014-Aug-07 18:50 
AnswerRe: Unlocking a folder Pin
Stephen Hewitt14-Aug-07 20:09
Stephen Hewitt14-Aug-07 20:09 
GeneralRe: Unlocking a folder Pin
indra2015-Aug-07 6:10
indra2015-Aug-07 6:10 
QuestionRe: Unlocking a folder Pin
David Crow15-Aug-07 7:15
David Crow15-Aug-07 7:15 
AnswerRe: Unlocking a folder Pin
indra2015-Aug-07 8:08
indra2015-Aug-07 8:08 
Questiondestructor - string, multimap, ifstream Pin
devvvy14-Aug-07 17:30
devvvy14-Aug-07 17:30 
AnswerRe: destructor - string, multimap, ifstream Pin
Maxwell Chen14-Aug-07 17:34
Maxwell Chen14-Aug-07 17:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.