¿¹Á¦

#include "BaseClass.h"

struct ST
{
int a;
char c;
};
   
class Derived : Base{

public:
Derived();
Derived(const Derived& toCopy);

private:
int x;
int y;

ST myStructure;
};

Derived::Derived(const Derived& toCopy)
{
x = toCopy.x;
y = toCopy.y;

myStructure.a = toCopy.myStructure.a;
myStructure.c = toCopy.myStructure.c;
}

¼Ö·ç¼Ç
±âº» Ŭ·¡½ºÀÇ º¹»ç »ý¼ºÀÚµµ ÇÔ²² È£ÃâÇϽʽÿÀ.

#include "BaseClass.h"

struct ST
{
int a;
char c;
};
   
class Derived : Base{

public:
Derived();
Derived(const Derived& toCopy);

private:
int x;
int y;

ST myStructure;
};

Derived::Derived(const Derived& toCopy) : Base(toCopy)
{
x = 
toCopy.x;
y = 
toCopy.y;

myStructure.a = 
toCopy.myStructure.a;
myStructure.c = 
toCopy.myStructure.c;
}