Click here to Skip to main content
14,970,162 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Pass a function with parameter Pin
Member 1496877115-Jun-21 15:23
MemberMember 1496877115-Jun-21 15:23 
GeneralRe: Pass a function with parameter Pin
Greg Utas16-Jun-21 0:22
mvaGreg Utas16-Jun-21 0:22 
QuestionRegarding Constructor Calling in C++ Pin
Member 1522917415-Jun-21 3:08
MemberMember 1522917415-Jun-21 3:08 
AnswerRe: Regarding Constructor Calling in C++ Pin
David Crow15-Jun-21 3:29
MemberDavid Crow15-Jun-21 3:29 
GeneralRe: Regarding Constructor Calling in C++ Pin
Member 1522917415-Jun-21 3:55
MemberMember 1522917415-Jun-21 3:55 
GeneralRe: Regarding Constructor Calling in C++ Pin
Richard MacCutchan15-Jun-21 5:02
mveRichard MacCutchan15-Jun-21 5:02 
AnswerRe: Regarding Constructor Calling in C++ Pin
Maximilien15-Jun-21 5:01
MemberMaximilien15-Jun-21 5:01 
AnswerRe: Regarding Constructor Calling in C++ Pin
CPallini15-Jun-21 23:39
mveCPallini15-Jun-21 23: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 8:32
Memberarnold_w14-Jun-21 8: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 8:43
MemberVictor Nijegorodov14-Jun-21 8: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 8:45
mvaMircea Neacsu14-Jun-21 8: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 8:51
mveRichard MacCutchan14-Jun-21 8: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 9:18
professionalEddy Vluggen14-Jun-21 9: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 5:22
MemberMaximilien15-Jun-21 5:22 
QuestionWindows 10 - find last logon time in C++ ?? Pin
Derell Licht5-Jun-21 16:28
professionalDerell Licht5-Jun-21 16:28 
QuestionRe: Windows 10 - find last logon time in C++ ?? Pin
David Crow5-Jun-21 16:53
MemberDavid Crow5-Jun-21 16:53 
AnswerRe: Windows 10 - find last logon time in C++ ?? Pin
Derell Licht5-Jun-21 17:06
professionalDerell Licht5-Jun-21 17:06 
AnswerRe: Windows 10 - find last logon time in C++ ?? Pin
Derell Licht5-Jun-21 17:11
professionalDerell Licht5-Jun-21 17:11 
AnswerRe: Windows 10 - find last logon time in C++ ?? Pin
Randor 6-Jun-21 5:21
professional Randor 6-Jun-21 5:21 
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Derell Licht6-Jun-21 6:27
professionalDerell Licht6-Jun-21 6:27 
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Randor 6-Jun-21 7:26
professional Randor 6-Jun-21 7:26 
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Derell Licht6-Jun-21 7:44
professionalDerell Licht6-Jun-21 7:44 
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Randor 6-Jun-21 8:11
professional Randor 6-Jun-21 8:11 
AnswerRe: Windows 10 - find last logon time in C++ ?? Pin
Derell Licht6-Jun-21 15:20
professionalDerell Licht6-Jun-21 15:20 
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Richard MacCutchan6-Jun-21 21:16
mveRichard MacCutchan6-Jun-21 21: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.