what is difference between structure and classes
A struct is syntactically similar to a class and both create a class type. In the C language a struct can contain only data memebers but this limitation does not apply to C++. In C++ the struct is essentially just an alternative way to specify a class. In fact, in C++ the only difference between a class and a struct is that by default all members are public in a struct and private in a class. In all other aspects structures and classes are equivalent.
structures do allow that. First declare a class add data and functions and then change the keyword class to struct. It will still work
classes let you declare functions in them as well as let you define who can access these functions and member variables. structures don't