When to use pointers?
From: Erik Jälevik (erik.jalevikDELETE_at_ntlworldTHIS.com)
Date: 12/26/03
- Next message: Gary Labowitz: "Re: When to use pointers?"
- Previous message: Ulrich Eckhardt: "Re: probs with a simple program"
- Next in thread: Gary Labowitz: "Re: When to use pointers?"
- Reply: Gary Labowitz: "Re: When to use pointers?"
- Reply: Jeff Schwab: "Re: When to use pointers?"
- Reply: Ulrich Eckhardt: "Re: When to use pointers?"
- Reply: jeffc: "Re: When to use pointers?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 26 Dec 2003 20:52:48 -0000
Here's a probably quite stupid question but I'm still learning...
>From what I've understood, the main reason for using pointers in C++ is that
it allows pass-by-reference function calls. So, if you in a class have a
large member object that you know you will never pass around as a parameter,
would it be pointless to make this a pointer?
An example:
class A {
private:
B arrayOfBs[100];
}
If I know that I will never pass arrayOfBs around, is there any reason to
make the above a pointer to the array instead of as here, allocating the
whole thing on the stack?
Thanks,
Erik
- Next message: Gary Labowitz: "Re: When to use pointers?"
- Previous message: Ulrich Eckhardt: "Re: probs with a simple program"
- Next in thread: Gary Labowitz: "Re: When to use pointers?"
- Reply: Gary Labowitz: "Re: When to use pointers?"
- Reply: Jeff Schwab: "Re: When to use pointers?"
- Reply: Ulrich Eckhardt: "Re: When to use pointers?"
- Reply: jeffc: "Re: When to use pointers?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|