Click here to Skip to main content
16,008,175 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Logitech QuickCam SDK? Pin
Joshua Nussbaum14-Dec-02 12:13
Joshua Nussbaum14-Dec-02 12:13 
Generali downloaded the SDK Pin
devvvy14-Dec-02 14:59
devvvy14-Dec-02 14:59 
Generalone cool feature: motion detection Pin
devvvy14-Dec-02 15:07
devvvy14-Dec-02 15:07 
GeneralRe: one cool feature: motion detection Pin
leppie14-Dec-02 21:11
leppie14-Dec-02 21:11 
GeneralCWinThread and SetThreadDesktop Pin
Nish Nishant14-Dec-02 6:50
sitebuilderNish Nishant14-Dec-02 6:50 
GeneralRe: CWinThread and SetThreadDesktop Pin
Stephane Rodriguez.14-Dec-02 23:16
Stephane Rodriguez.14-Dec-02 23:16 
GeneralRe: CWinThread and SetThreadDesktop Pin
Nish Nishant14-Dec-02 23:27
sitebuilderNish Nishant14-Dec-02 23:27 
GeneralC++: playing with constructors Pin
14-Dec-02 5:43
suss14-Dec-02 5:43 
Hey everyone!

Okay, I need to know how to pass an instance of a class as a parameter for a constructor, and then have that constructor call the constructor of the supplied parameter. Kinda like this piece of code:

class classA
{
public:
classA (int somevalue, classB classBInstance);
void wasteTime ();
private:
classB *classBInstanceCopy;
};

class classB
{
public:
classB () { };
classB (int somevalue);

int something;
};

classB::classB (int somevalue)
{
something = somevalue;
}

classA::classA (int somevalue, classB classBInstance) : classBInstance (somevalue)
{
classBInstanceCopy = &classBInstance;
}

void classA::wasteTime ()
{
printf ("Hey, how about a %d?", classBInstanceCopy->something);
}

void main ()
{
classB myInstance;

classA myClass (myInstance);
myClass.wasteTime ();
}

I think you get the idea: I wanna have a class where the constructor takes another class as a parameter, call the constructor of that class and then later be able to reference that supplied class. How is that possible? I'm sure there's some way using pointers, but how? Oh, and anyone know how I can get rid of that empty classB constructor? As far as I understand it's only there so I can create an instance of classB in the fassion of "classB myInstance". So, if anyone has an idea, let me know!

Thanks
tilli

GeneralRe: C++: playing with constructors Pin
valikac14-Dec-02 6:45
valikac14-Dec-02 6:45 
GeneralRe: C++: playing with constructors Pin
- tilli -14-Dec-02 11:46
suss- tilli -14-Dec-02 11:46 
GeneralRe: C++: playing with constructors Pin
14-Dec-02 12:30
suss14-Dec-02 12:30 
GeneralRe: C++: playing with constructors Pin
valikac15-Dec-02 16:18
valikac15-Dec-02 16:18 
GeneralHelp with Help documentation Pin
DanYELL14-Dec-02 2:50
DanYELL14-Dec-02 2:50 
GeneralGetting Information about outgoing socket connection Pin
Chintan14-Dec-02 1:46
Chintan14-Dec-02 1:46 
GeneralRe: Getting Information about outgoing socket connection Pin
Magius9614-Dec-02 3:28
Magius9614-Dec-02 3:28 
QuestionHow to programatically get page text from Internet Explorer Pin
Konrad Rotuski14-Dec-02 1:44
Konrad Rotuski14-Dec-02 1:44 
AnswerRe: How to programatically get page text from Internet Explorer Pin
valikac14-Dec-02 6:47
valikac14-Dec-02 6:47 
Generalexpense of creating GDI objects Pin
Raja Huus again14-Dec-02 1:30
sussRaja Huus again14-Dec-02 1:30 
GeneralRe: expense of creating GDI objects Pin
Rickard Andersson2014-Dec-02 1:41
Rickard Andersson2014-Dec-02 1:41 
GeneralRe: cost Pin
Anonymous14-Dec-02 1:48
Anonymous14-Dec-02 1:48 
GeneralA question for the advanced programers Pin
Magius9613-Dec-02 23:39
Magius9613-Dec-02 23:39 
GeneralRe: A question for the advanced programers Pin
ColinDavies14-Dec-02 0:03
ColinDavies14-Dec-02 0:03 
GeneralRe: A question for the advanced programers Pin
Magius9614-Dec-02 1:07
Magius9614-Dec-02 1:07 
GeneralRe: A question for the advanced programers Pin
Jörgen Sigvardsson14-Dec-02 1:12
Jörgen Sigvardsson14-Dec-02 1:12 
GeneralRe: A question for the advanced programers Pin
Jörgen Sigvardsson14-Dec-02 1:14
Jörgen Sigvardsson14-Dec-02 1:14 

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.