C++ is one of several programming languages that hackers may employ for a variety of objectives. Thus yes, it may be used for hacking. The variety of activities that are included in hacking determines the best programming language to use for the task at hand.
C++ can be helpful for creating exploits, creating unique tools, or evaluating software. However, depending on the situation and the hacker's tastes, other languages like Python, C#, or assembly language may also be utilized.
It's crucial to remember that hacking for unlawful or unethical reasons is in and of itself illegal and unethical. With permission, ethical hackers test and secure systems.