Friends,

This is a purely theoretical question. Tell me where this function can be used. What is the practical meaning of it?

int& foo()=7; 

Details: the type is not fundamental, the whole is taken simply as an example.

Thank you very much in advance.

  • 3
    Uh ... I hope it doesn't compile? (Maybe you meant = 0 ?) - VladD
  • There is no arbitrary int and this does not apply to pure Wirth methods - Andriy_abc
  • 2
    maybe some code fell out there? and in fact there is something like int & foo () {// ....} // .... foo () = 7; and the cunning editor man decided to shorten. - KoVadim
  • one
    @avp - I do not see practical value in such a record. - KoVadim
  • one
    Oddly enough, me too. - avp

1 answer 1

It does not compile and should not. It is used primarily in books to show something. Practical, does not make any sense, only theoretical is used.

  • 2
    @Airhand, what exactly do they want to show with just such a record? - avp