Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > A const pointer question

Reply
Thread Tools

A const pointer question

 
 
Tony Johansson
Guest
Posts: n/a
 
      08-15-2005
Hello Experts!


I do know what this expression mean const Student stud;
I do also know what this expression const int* i ;
But I don't know what this expression mean const Student* stud;

If you like give some examples.

Many thanks

//Tony




 
Reply With Quote
 
 
 
 
Rolf Magnus
Guest
Posts: n/a
 
      08-15-2005
Tony Johansson wrote:

> Hello Experts!
>
>
> I do know what this expression mean const Student stud;
> I do also know what this expression const int* i ;
> But I don't know what this expression mean const Student* stud;


It means the same as the one before, with just the type int replaced by
Student, i.e. it points to an instance of type Student, and that instance
can't be modified through the pointer. What's unclear about that?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
const pointer versus const content pointed to by pointer Disc Magnet C Programming 1 05-06-2010 10:27 AM
Question about declaring const pointer to const value linq936 C Programming 2 09-18-2007 06:27 AM
const vector<A> vs vector<const A> vs const vector<const A> Javier C++ 2 09-04-2007 08:46 PM
Smart Pointer release() const : it can set the pointer to null with the keyword "const"? coala C++ 1 09-06-2006 03:00 PM
Smart Pointer release() const : it can set the pointer to null with the keyword "const"? coala C++ 3 09-06-2006 02:58 PM



Advertisments