Click here to Skip to main content
14,580,566 members

C / C++ / MFC

 
AnswerRe: Print Bitmap from Printing Class Library Pin
leon de boer31-Oct-18 17:27
Memberleon de boer31-Oct-18 17:27 
QuestionReferencing a class in other in a other class Pin
ForNow28-Oct-18 3:43
MemberForNow28-Oct-18 3:43 
AnswerRe: Referencing a class in other in a other class Pin
Victor Nijegorodov28-Oct-18 7:35
MemberVictor Nijegorodov28-Oct-18 7:35 
GeneralRe: Referencing a class in other in a other class Pin
ForNow28-Oct-18 7:37
MemberForNow28-Oct-18 7:37 
GeneralRe: Referencing a class in other in a other class Pin
Richard MacCutchan28-Oct-18 11:34
mveRichard MacCutchan28-Oct-18 11:34 
GeneralRe: Referencing a class in other in a other class Pin
Stefan_Lang31-Oct-18 3:59
mveStefan_Lang31-Oct-18 3:59 
AnswerRe: Referencing a class in other in a other class Pin
Joe Woodbury28-Oct-18 9:02
professionalJoe Woodbury28-Oct-18 9:02 
AnswerRe: Referencing a class in other in a other class Pin
Bram van Kampen2-Nov-18 14:31
MemberBram van Kampen2-Nov-18 14:31 
Well, Well, Well!

This question is the result of too much abstraction in education of computer scientists!
A bit of learning of how a compiler works, Things like Bits and Bytes, the underlying mechanisms, and what it cannot do would help you here. This is an insolvable problem! Ultimately, a compiler lays out code, reserves blocks of memory of a certain size, etc.

The compiler needs to know how much memory is needed for each user defined type (in C(++)) that is a union, structure or a class!
When you Declare a class, you tell the compiler to take note of the name of the class! The Linker may than be able to find that class properly defined in another file, and hence in another .obj file! The compiler cannot at that stage know anything about the size of the object, so, all you can use is either a pointer of an object of that type, or, a reference to it! A Reference to an object is very similar to a pointer, it is a compiler guaranteed pointer, that cannot be null, and always points at an object of the type!

In Your code class 'c' needs to be defined in the file before class a in which it is used! Otherwise your compiler cannot calculate the size of class a!

Best of luck learning more,

There may be rules around this conundrum in synthetic languages such as C#,Java etc. I would know nothing of these! There are no such shortcuts in C or CPP!

I encourage anyone to take up C or CPP! It are the base languages on which all others are built! A knowledge of Machine Code, and how it translates in ASM, would also help you
Bram van Kampen

QuestionPrivate test case failed Pin
Member 1403429426-Oct-18 9:35
MemberMember 1403429426-Oct-18 9:35 
SuggestionRe: Private test case failed Pin
Richard MacCutchan26-Oct-18 22:41
mveRichard MacCutchan26-Oct-18 22:41 
QuestionRe: Private test case failed Pin
David Crow29-Oct-18 7:11
MemberDavid Crow29-Oct-18 7:11 
QuestionCatch javascript event in CHtmlView Pin
_Flaviu23-Oct-18 23:37
Member_Flaviu23-Oct-18 23:37 
GeneralRe: Catch javascript event in CHtmlView Pin
_Flaviu26-Oct-18 1:14
Member_Flaviu26-Oct-18 1:14 
AnswerRe: Catch javascript event in CHtmlView Pin
Afzaal Ahmad Zeeshan24-Oct-18 0:51
mvaAfzaal Ahmad Zeeshan24-Oct-18 0:51 
Questiondouble signed comparison in C++ Pin
kamal197723-Oct-18 16:42
Memberkamal197723-Oct-18 16:42 
AnswerRe: double signed comparison in C++ Pin
CPallini23-Oct-18 20:47
mveCPallini23-Oct-18 20:47 
AnswerRe: double signed comparison in C++ Pin
Victor Nijegorodov23-Oct-18 21:04
MemberVictor Nijegorodov23-Oct-18 21:04 
Questionclistctrl class Pin
Jim Overby23-Oct-18 8:01
MemberJim Overby23-Oct-18 8:01 
AnswerRe: clistctrl class Pin
Victor Nijegorodov23-Oct-18 8:11
MemberVictor Nijegorodov23-Oct-18 8:11 
AnswerRe: clistctrl class Pin
Joe Woodbury23-Oct-18 8:29
professionalJoe Woodbury23-Oct-18 8:29 
SuggestionRe: clistctrl class Pin
David Crow23-Oct-18 9:34
MemberDavid Crow23-Oct-18 9:34 
Questionhelp Pin
sabrina life19-Oct-18 7:54
Membersabrina life19-Oct-18 7:54 
AnswerRe: help Pin
OriginalGriff19-Oct-18 8:00
mveOriginalGriff19-Oct-18 8:00 
GeneralRe: ? Pin
sabrina life19-Oct-18 8:21
Membersabrina life19-Oct-18 8:21 
RantRe: ? Pin
David Crow19-Oct-18 10:04
MemberDavid Crow19-Oct-18 10:04 

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.