I have the following code in c++:
typedef struct
{
int a;
int b;
float c;
} Data;
class DataInfo : public Data
{
// some code here
};
my question is can class inherit struct in C++? how this happens?
I have the following code in c++:
typedef struct
{
int a;
int b;
float c;
} Data;
class DataInfo : public Data
{
// some code here
};
my question is can class inherit struct in C++? how this happens?
struct
is included in C++ to provide complitability with C. It has same functionality as class
, but members in struct are public
by default. So you can inherit class
from struct
and do the same in reverse.