Click here to Skip to main content
15,902,721 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Exceptions Pin
Alvaro Mendez4-Sep-03 17:40
Alvaro Mendez4-Sep-03 17:40 
GeneralRe: Exceptions Pin
Rickard Andersson204-Sep-03 22:41
Rickard Andersson204-Sep-03 22:41 
GeneralRe: Exceptions Pin
jhwurmbach5-Sep-03 1:18
jhwurmbach5-Sep-03 1:18 
GeneralRe: Exceptions Pin
Andrew Walker5-Sep-03 1:32
Andrew Walker5-Sep-03 1:32 
Questionhow to schedule a a thread to a specific CPU? Pin
Anonymous4-Sep-03 12:46
Anonymous4-Sep-03 12:46 
AnswerRe: how to schedule a a thread to a specific CPU? Pin
Michael Dunn4-Sep-03 13:20
sitebuilderMichael Dunn4-Sep-03 13:20 
GeneralRe: how to schedule a a thread to a specific CPU? Pin
Anonymous5-Sep-03 13:15
Anonymous5-Sep-03 13:15 
GeneralNeed for derived class to show base clase object. Pin
WREY4-Sep-03 12:29
WREY4-Sep-03 12:29 
Here's the situation:
class A
{
public:
   friend ostream& operator<<(ostream& os, const A& a)
public:
   void ShowExpandedInfo() { cout<<this <<endl; }
   // other stuff
};
=================
class B : public A
{
public:
   void RunOuterLoop();
   // other stuff
};
=================
int main()
{
   A a;
   B b;
   b.RunOuterLoop();
   // etc.
   return 0;
}
==================
void B::RunOuterLoop()
{
   // other stuff
   ShowExpandedInfo();
}

The problem (as you all know) is that in activating ShowExpandedInfo (from RunOuterLoop), what gets shown, is B's data instead of A's.

Inside the 'friend' function is where I do formatting (etc.) of A's data prior to printing.

I've tried just about every trick and clever idea I could come up with, to get A's data to show, which the compiler dutifully shoots down every time.

The sample is not written in stone. It gets changed around with some of the various things I try. What is shown, is merely a starting point to demonstrate the general layout of code, and what I'm trying to accomplish.

I would be remiss if I didn't say one of the things I tried, was to use a 'const' reference of 'A' as a parameter of RunOuterLoop (and changed the code to suit that approach). It didn't work, since that simply showed and empty 'A'.

Thanks for any thoughts or ideas on how I can get A's object to show from 'B'?

Smile | :)

William

Fortes in fide et opere!
Generalbad design Pin
dog_spawn4-Sep-03 12:46
dog_spawn4-Sep-03 12:46 
GeneralTalk is cheap!! Show me the money!! Pin
WREY4-Sep-03 14:29
WREY4-Sep-03 14:29 
GeneralEr Pin
dog_spawn4-Sep-03 16:36
dog_spawn4-Sep-03 16:36 
GeneralRe: Need for derived class to show base clase object. Pin
Alvaro Mendez4-Sep-03 17:28
Alvaro Mendez4-Sep-03 17:28 
GeneralRe: Need for derived class to show base clase object. Pin
WREY4-Sep-03 21:17
WREY4-Sep-03 21:17 
GeneralRe: Need for derived class to show base clase object. Pin
Jason Henderson4-Sep-03 18:24
Jason Henderson4-Sep-03 18:24 
GeneralRe: Need for derived class to show base clase object. Pin
WREY4-Sep-03 22:25
WREY4-Sep-03 22:25 
GeneralSetting intermediate files path to a global folder using an environment variable Pin
Jean-Marc Molina4-Sep-03 12:08
Jean-Marc Molina4-Sep-03 12:08 
QuestionHow to open a folder using MFC Pin
nachilau4-Sep-03 10:57
nachilau4-Sep-03 10:57 
AnswerRe: How to open a folder using MFC Pin
Ravi Bhavnani4-Sep-03 11:13
professionalRavi Bhavnani4-Sep-03 11:13 
GeneralRe: How to open a folder using MFC Pin
nachilau4-Sep-03 12:01
nachilau4-Sep-03 12:01 
GeneralRe: How to open a folder using MFC Pin
Rickard Andersson204-Sep-03 12:09
Rickard Andersson204-Sep-03 12:09 
GeneralRe: How to open a folder using MFC Pin
Ravi Bhavnani4-Sep-03 12:43
professionalRavi Bhavnani4-Sep-03 12:43 
GeneralScreen Coordinates/Front-Back Pin
DougW484-Sep-03 9:22
DougW484-Sep-03 9:22 
GeneralRe: Screen Coordinates/Front-Back Pin
PJ Arends4-Sep-03 10:01
professionalPJ Arends4-Sep-03 10:01 
GeneralRe: Screen Coordinates/Front-Back Pin
dog_spawn4-Sep-03 12:47
dog_spawn4-Sep-03 12:47 
GeneralAntivirus Pin
Anonymous4-Sep-03 9:22
Anonymous4-Sep-03 9:22 

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.