简体   繁体   中英

Is there a quick way to know a class member's accessibility of a huge class?

I'm using Visual Studio with Visual Assist.

I found if a class gets too big, you have to scroll up to check the access modifiers to know if the method or variable is public, protected, or etc. It takes some time and the access modifier could be missed if you scroll too fast.

Is there a way, like a short cut or sth in Intellisense/Visual Assist, to let me know a member's accessibility immediately?

(Scenario: exploring Unreal Engine source code...)

There would be no problem to add the visibility before each class member like this:

class Foo {
    public:    float foobaz1();
    public:    void foobaz2();

    protected: int baz1();
    protected: std::string baz2();

    private:   int bar1();
    private:   double bar2();
};

Unusual 1 , but syntactically correct.


OK as you mention Unreal-Engine as a project that's out of your control. For such I'd try to find a decent IDE, that supports a compact tree view, which shows all class members ordered by scope, alhpabetically (or other criterie) for quick navigation.

Any IDE, that supports intellisense should have such feature because the code needs to be roughly parsed anyways.

I am pretty sure that Visual Studio supports that (not sure about VS Code). Eclipse may be, I can't remember, I use such fancy stuff rarely anyways, and usually prefer to break stuff down in smaller units.

Other preferred method:

CTRL f , type public , get there, and look down. Faster than scrolling at least.


1) The c++ guys will sent you to the Java penalty corner though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM