Hey all,
I've have seemed to successfully pass a reference to a LiquidCrystal object to my constructor, however, when I try to use this reference, I get this error:
request for member 'clear' in '((Bullet*)this)->Bullet::_lcdScreen', which is of non-class type 'LiquidCrystal*'
Here is my code:
------ Bullet.cpp ------
/*
Bullet.cpp - The library for the bullets.
Created by duckboy81, Jun 2012.
*/
#include "Arduino.h"
#include "Bullet.h"
#include <LiquidCrystal.h>
Bullet::Bullet(int startCol, int startRow, int startMoveSpeed, LiquidCrystal* startLcdScreen)
{
_lcdScreen = startLcdScreen;
colPos = startCol;
rowPos = startRow;
moveSpeed = startMoveSpeed;
currSpeedClock = 0;
_lcdScreen.clear();
}//Bullet()
------ Bullet.h ------
/*
Bullet.h - The library for the bullets.
Created by duckboy81, Jun 2012.
*/
#ifndef Bullet_h
#define Bullet_h
#include "Arduino.h"
#include <LiquidCrystal.h>
class Bullet {
public:
Bullet(int, int, int, LiquidCrystal*);
int getCol();
int getRow();
int updateDraw();
private:
int rowPos;
int colPos;
int moveSpeed;
int currSpeedClock;
LiquidCrystal* _lcdScreen;
};
#endif
If I try to use startLcdScreen instead for a call such as "startLcdScreen.clear()" I also get an error:
error: request for member 'clear' in 'startLcdScreen', which is of non-class type 'LiquidCrystal*'
Thanks for you help in advance!
EDIT: SOLVED
I needed to use this kind of constructor
Bullet::Bullet(int startCol, int startRow, int startMoveSpeed, LiquidCrystal& startLcdScreen) : lcdScreen(startLcdScreen)