I need to change the struct "class" to "struct normal" to make it easy to read the source code. It's possible, change "class" in the beginning of the code to "struct" in the source code in Program to create a queue using dynamic memory allocation.
It is hard to understand what exactly your question is. A struct
in C++ is the same as a class
, except that members are by default public
instead of private
.
If you have a struct
and you want to make it a class
, you can do that like this:
struct Thing {
// ...
};
// Change this to:
class Thing {
public:
// ...
};
Or, the other way around, a class
to a struct
:
class Thing {
// ...
};
// Change this to:
struct Thing {
private:
// ...
};
I don't see, however, how one would be "more readable" than the other.
Change class to struct =
1) Find a "Find and Replace" button in your IDE or text editor
2) In Find What field enter class
3) In Replace With field enter struct
4) click Replace All
Yeah this is a crappy answer, but so is the question :)
精彩评论