Quick Answer

Accessing members on non-class types

Understanding the Issue

This error occurs when trying to use the dot or arrow operator on something that isn't a class/struct/union instance or pointer.

The Problem

This code demonstrates the issue:

Cpp Error
// Problem: Non-class access
int x;
x.some_member = 5; // Error

The Solution

Here's the corrected code:

Cpp Fixed
// Solution: Only on classes
struct Point { int x,y; };
Point p;
p.x = 5; // Valid

Key Takeaways

Member access only works on class/struct/union types.