Thread View: comp.std.c++
2 messages
2 total messages
Started by Alexandre Oliva
Wed, 28 Oct 1992 18:09
Declaring *this const
Author: Alexandre Oliva
Date: Wed, 28 Oct 1992 18:09
Date: Wed, 28 Oct 1992 18:09
9 lines
733 bytes
733 bytes
Is there any way to declare, in a member function, that the object it will operate on, that is, *this, is const? Alexandre Oliva oliva@dcc.unicamp.br Depto de Ciencia da Computacao DCC - IMECC - UNICAMP Campinas SP Brazil
Re: Declaring *this const
Author: Bjarne Stroustrup
Date: Thu, 29 Oct 1992 02:27
Date: Thu, 29 Oct 1992 02:27
15 lines
896 bytes
896 bytes
oliva@dcc.unicamp.br (Alexandre Oliva @ The Ohio State University Department of Computer and Information Science)writes
> Is there any way to declare, in a member function, that the object it
> will operate on, that is, *this, is const?
yes:
class X {
void f() const; // f()'s *this is const
void g(); // g()'s *this is non-const
};
See the ARM or any decent C++ textbook.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads