Click here to Skip to main content
16,005,734 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Couldn't bool be better in C++?? Pin
Maximilien23-Jun-05 5:37
Maximilien23-Jun-05 5:37 
AnswerRe: Couldn't bool be better in C++?? Pin
Chris Losinger23-Jun-05 5:39
professionalChris Losinger23-Jun-05 5:39 
AnswerRe: Couldn't bool be better in C++?? Pin
toxcct23-Jun-05 5:48
toxcct23-Jun-05 5:48 
AnswerRe: Couldn't bool be better in C++?? Pin
basementman23-Jun-05 6:41
basementman23-Jun-05 6:41 
GeneralRe: Couldn't bool be better in C++?? Pin
Blake Miller23-Jun-05 7:44
Blake Miller23-Jun-05 7:44 
GeneralRe: Couldn't bool be better in C++?? Pin
basementman23-Jun-05 7:49
basementman23-Jun-05 7:49 
AnswerRe: Couldn't bool be better in C++?? Pin
Bob Stanneveld23-Jun-05 7:24
Bob Stanneveld23-Jun-05 7:24 
GeneralBase class initialization problem Pin
pesho293223-Jun-05 5:09
pesho293223-Jun-05 5:09 
Imagine the following situation:

class A<br />
{<br />
public:<br />
  A(int x, int y) {...}<br />
};<br />
<br />
int func1()<br />
{<br />
  return ...; // every time returns different int<br />
}<br />
<br />
int func2(int arg)<br />
{<br />
   return arg / 2; // for example<br />
}


You can not change the above. But you need to inherit from A and you want to pass func1() as the first argument and func2 of the first argument as the second argument to the constructor of A:

class B : public A<br />
{<br />
public:<br />
  B():A(func1(), func2(/*get the first argument here somehow*/))<br />
  {<br />
  } <br />
};


What do you think is the best way to do this? A possible solution is:
class B : public A<br />
{<br />
protected:<br />
  B(int x, int y):A(x, y))<br />
  {<br />
  } <br />
<br />
public:<br />
  static B create()<br />
  {<br />
    int f1 = func1();<br />
    return B(f1, func2(f1));<br />
  }<br />
};


However, this would obstruct future inheritance from B.
GeneralRe: Base class initialization problem Pin
Jose Lamas Rios23-Jun-05 5:34
Jose Lamas Rios23-Jun-05 5:34 
GeneralRe: Base class initialization problem Pin
pesho293223-Jun-05 21:29
pesho293223-Jun-05 21:29 
GeneralFile Properties Pin
Rage23-Jun-05 4:22
professionalRage23-Jun-05 4:22 
GeneralRe: File Properties Pin
David Crow23-Jun-05 4:36
David Crow23-Jun-05 4:36 
GeneralRe: File Properties Pin
Rage23-Jun-05 20:54
professionalRage23-Jun-05 20:54 
GeneralRe: File Properties Pin
David Crow24-Jun-05 2:33
David Crow24-Jun-05 2:33 
GeneralHELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
Ana-bahy23-Jun-05 3:32
Ana-bahy23-Jun-05 3:32 
GeneralRe: HELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
Cedric Moonen23-Jun-05 3:47
Cedric Moonen23-Jun-05 3:47 
GeneralRe: HELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
ana_bahy23-Jun-05 3:55
ana_bahy23-Jun-05 3:55 
GeneralRe: HELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
ana_bahy23-Jun-05 3:57
ana_bahy23-Jun-05 3:57 
GeneralRe: HELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
ana_bahy23-Jun-05 4:02
ana_bahy23-Jun-05 4:02 
GeneralRe: HELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
Cedric Moonen23-Jun-05 4:05
Cedric Moonen23-Jun-05 4:05 
GeneralRe: HELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
Cedric Moonen23-Jun-05 4:03
Cedric Moonen23-Jun-05 4:03 
GeneralRe: HELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
ana_bahy23-Jun-05 4:07
ana_bahy23-Jun-05 4:07 
GeneralRe: HELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
Cedric Moonen23-Jun-05 4:13
Cedric Moonen23-Jun-05 4:13 
GeneralRe: HELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
ana_bahy23-Jun-05 4:17
ana_bahy23-Jun-05 4:17 
GeneralRe: HELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
Bob Stanneveld23-Jun-05 4:34
Bob Stanneveld23-Jun-05 4: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.