Inheritance/Multiple: Difference between revisions
Content deleted Content added
Added C implementation |
|||
Line 45:
PROC_inherit(CameraPhone{}, MobilePhone{})
PROC_class(CameraPhone{})</lang>
=={{header|C}}==
C simulates Multiple Inheritance via Structures.
<lang C>
typedef struct{
double focalLength;
double resolution;
double memory;
}Camera;
typedef struct{
double balance;
double batteryLevel;
char** contacts;
}Phone;
typedef struct{
Camera cameraSample;
Phone phoneSample;
}CameraPhone;
</lang>
=={{header|C++}}==
|