'declare/create class member of another class type in Python?
Is it possible to declare class member of another class type in Python like C? for ex. struct transmit_message below has a member config of struct config_data type.
in C:
enum message_type {
MESSAGE_NONE,
MESSAGE_PING,
WRITE_DATA,
READ_DATA,
};
struct read_data {
int gender;
unsigned int age;
};
struct write_data {
bool flag;
char name[10];
};
struct config_data {
write_data write_config;
read_data read_config;
};
struct transmit_message {
message_type type;
config_data config;};
transmit_message message; // **how to create similar object in python?**
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
