Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17560

expression must have class type

$
0
0

I am working on a AABB collision detection function. I am getting a “expression must have class type” on my “one” variable in my checkCollision function. I have googled this error and have looked at other sites but with no luck on finding an answer. I am learning about pointers and passing by reference. here is my short piece of code.

#include<iostream>

using namespace std;

bool CheckCollision(GameObject &one, GameObject &two); // AABB - AABB collision

class GameObject
{
public:
	int Position;
	int Size;
	int x;
	int y;
};

int main()
{ 
	GameObject one,two;
	one.x = 0;
	one.y = 0;
	one.Position = 0;
	one …

Viewing all articles
Browse latest Browse all 17560

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>