FishBoy
Feeeesh
- Joined
- 1 Aug 2004
- Messages
- 1,685
hey i just wanted to ask how to use the '->' pointer in c++
im getting this error when i compile i'd attach the source code but they are in 5 files
here is a small part of it
that's the struct definition
and here is where i initialized them
im getting the error on a couple of other lines but they're the same idea, if that makes enough sense (hopefully) how could that be fixed
im getting this error when i compile i'd attach the source code but they are in 5 files
layout.cpp:58: error: base operand of `->' has non-pointer type `WwText'
here is a small part of it
that's the struct definition
Code:
struct Field{
int left;
int top;
int right;
int bottom;
WwText &txt;
};
Field data[50];
int rect;
Code:
int Layout::add(int left,int top,int right,int bottom,WwText&txt){
...
data[rect].left=left;
data[rect].top=top;
data[rect].right=right;
data[rect].bottom=bottom;
data[rect].txt=txt;
//the txt on the right side is a reference too in a function parameter
//edit: plus im not sure if i declared it right
...
...
...
58: str=new(nothrow)char[data[rect].txt->length()];
//and that's line 58 where it's giving me that error