The only difference between a class and a structure in C++ is that of Access specifiers.
For classes the access specifier is private by default.
For structures the access specifier is public by default.
This means if you have a class deriving from other class/struct it will be private inheritance by default &
If you have a structure deriving from other class/structure it will be a public inheritance by default.
One problem though is that since for structure default access specifier is public, they may expose members that maybe should not be exposed to deriving classes. The entire encapsulation has a whole new dimension in this sense. Ofcourse, You If you can change the access specifiers inside the structure which you intend to use as Base, then it is possible to avoid the problem, but it may not be possible because that might affect how the structure is being used from other parts of the program.
EDIT:
Through the comments, I have a fair idea now, what errors you are referring to, the errors are not specifically because you are deriving from a structure but because you are misunderstanding the rules of Inheritance & Access specifiers.
Here is a sample program for demonstration:
#include<iostream>
using namespace std;
struct FirstStruct
{
private:
int a;
public:
int b;
FirstStruct():a(10),b(20),c(30)
{
}
protected:
int c;
};
class MyClass:protected FirstStruct
{
public:
int i;
MyClass():i(40),j(50),k(60)
{
}
void doSomething()
{
a = 100; //private in Base is not accessible in Derived
b = 100; //Accessible
c = 100; //Accessible
i = 100; //Accessible
b = 100; //Accessible
c = 100; //Accessible
}
private:
int j;
protected:
int k;
};
int main()
{
MyClass obj;
obj.i = 100; //Accessible
obj.j = 100; //Error Cannot be Accessed, j is private member
obj.k = 100; //Error Cannot be Accessed, k is protected member
obj.a = 100; //Error Cannot be Accessed, a is private member in Base Class
obj.b = 100; //Error Cannot be Accessed;
//b is protected member of MyClass, because of protected Inheritance
obj.c = 100; //Error Cannot be Accessed;
//same reason as b
obj.doSomething();
return 0;
}
You can check running the same here at Ideone.
You will notice even If you change the type of the Base from struct FirstStruct
to class FirstStruct
here you get the same errors(nothing more nothing less).
Suggest you to have a look at this answer here, to clear your understanding on Inheritance and Access specifier rules.