简体   繁体   中英

C++ — What is the meaning of this statement?

I saw the following class definition and cannot figure out the meaning of the line 1.

class Noisy {
public:
  Noisy() throw();
 ~Noisy() throw();
  Noisy& operator= (const Noisy&) throw();
  Noisy            (const Noisy&) throw(); // Line 1
};

What is the meaning of this line and what is the usage of this line?

Thank you

It isn't a statement. It is a declaration of a copy constructor that is specified as throwing no exceptions.

You can find out more in your favorite good introductory C++ book .

Look at this thread. It will give you some more insight. Should I use an exception specifier in C++?

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