Click here to Skip to main content
15,790,625 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralMessage Closed Pin
15-Jun-21 16:23
Member 1496877115-Jun-21 16:23 
GeneralRe: Pass a function with parameter Pin
Greg Utas16-Jun-21 1:22
mveGreg Utas16-Jun-21 1:22 
QuestionRegarding Constructor Calling in C++ Pin
Member 1522917415-Jun-21 4:08
Member 1522917415-Jun-21 4:08 
AnswerRe: Regarding Constructor Calling in C++ Pin
David Crow15-Jun-21 4:29
David Crow15-Jun-21 4:29 
GeneralRe: Regarding Constructor Calling in C++ Pin
Member 1522917415-Jun-21 4:55
Member 1522917415-Jun-21 4:55 
GeneralRe: Regarding Constructor Calling in C++ Pin
Richard MacCutchan15-Jun-21 6:02
mveRichard MacCutchan15-Jun-21 6:02 
AnswerRe: Regarding Constructor Calling in C++ Pin
Maximilien15-Jun-21 6:01
Maximilien15-Jun-21 6:01 
AnswerRe: Regarding Constructor Calling in C++ Pin
CPallini16-Jun-21 0:39
mveCPallini16-Jun-21 0:39 
Actually class C constructor should have had four (Yes, 4, since it contains four variables) parameters. Anyway...
Try
C++
#include <iostream>
using namespace std;
class A
{
public:
  int a;
  A(int a):a(a){}
};

class B: public A
{
public:
  int b;
  B(int a, int b): A(a), b(b){}
};


class C: public B
{
public:
  B obj;
  C(int a, int b): B(a, b), obj(b, a){} // swapped the arguments of 'obj' just to make it a little different
  friend ostream & operator << (ostream & os, const C & c); // overload the insertion operator just to show this object content
};

ostream & operator << (ostream & os, const C & c)
{
  os << "a = " << c.a << ", b = " << c.b << ", obj.a = " << c.obj.a << ", obj.b = " << c.obj.b;
  return os;
}

int main()
{
  C obj1(10,20);
  cout << obj1 << endl;
}

"In testa che avete, Signor di Ceprano?"
-- Rigoletto

QuestionAdvice on writing a GUI application that can run on very old Windows operating systems without Service Packs and Frameworks Pin
arnold_w14-Jun-21 9:32
arnold_w14-Jun-21 9:32 
AnswerRe: Advice on writing a GUI application that can run on very old Windows operating systems without Service Packs and Frameworks Pin
Victor Nijegorodov14-Jun-21 9:43
Victor Nijegorodov14-Jun-21 9:43 
AnswerRe: Advice on writing a GUI application that can run on very old Windows operating systems without Service Packs and Frameworks Pin
Mircea Neacsu14-Jun-21 9:45
Mircea Neacsu14-Jun-21 9:45 
AnswerRe: Advice on writing a GUI application that can run on very old Windows operating systems without Service Packs and Frameworks Pin
Richard MacCutchan14-Jun-21 9:51
mveRichard MacCutchan14-Jun-21 9:51 
AnswerRe: Advice on writing a GUI application that can run on very old Windows operating systems without Service Packs and Frameworks Pin
Eddy Vluggen14-Jun-21 10:18
professionalEddy Vluggen14-Jun-21 10:18 
AnswerRe: Advice on writing a GUI application that can run on very old Windows operating systems without Service Packs and Frameworks Pin
Maximilien15-Jun-21 6:22
Maximilien15-Jun-21 6:22 
QuestionWindows 10 - find last logon time in C++ ?? Pin
Derell Licht5-Jun-21 17:28
professionalDerell Licht5-Jun-21 17:28 
QuestionRe: Windows 10 - find last logon time in C++ ?? Pin
David Crow5-Jun-21 17:53
David Crow5-Jun-21 17:53 
AnswerRe: Windows 10 - find last logon time in C++ ?? Pin
Derell Licht5-Jun-21 18:06
professionalDerell Licht5-Jun-21 18:06 
AnswerRe: Windows 10 - find last logon time in C++ ?? Pin
Derell Licht5-Jun-21 18:11
professionalDerell Licht5-Jun-21 18:11 
AnswerRe: Windows 10 - find last logon time in C++ ?? Pin
Randor 6-Jun-21 6:21
professional Randor 6-Jun-21 6:21 
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Derell Licht6-Jun-21 7:27
professionalDerell Licht6-Jun-21 7:27 
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Randor 6-Jun-21 8:26
professional Randor 6-Jun-21 8:26 
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Derell Licht6-Jun-21 8:44
professionalDerell Licht6-Jun-21 8:44 
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Randor 6-Jun-21 9:11
professional Randor 6-Jun-21 9:11 
AnswerRe: Windows 10 - find last logon time in C++ ?? Pin
Derell Licht6-Jun-21 16:20
professionalDerell Licht6-Jun-21 16:20 
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Richard MacCutchan6-Jun-21 22:16
mveRichard MacCutchan6-Jun-21 22:16 

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.