开发者

Change "class" to "struct" [closed]

开发者 https://www.devze.com 2023-03-12 23:44 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly开发者_JAVA百科 broad, or rhetorical andcannot be reasonably answered in its current form.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly开发者_JAVA百科 broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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 :)

0

精彩评论

暂无评论...
验证码 换一张
取 消