Hi, so I finally got around to looking into OOP in c++ and I have a question about classes. So I made this simple class:
#include <iostream>
using namespace std;
class Shape {
int xPos, yPos;
public:
Shape(int x, int y) {
xPos=x;
yPos=y;
}
} ;
int main() {
Shape l = new Shape(5,5);
}
When I do this, I get the following error: "Line 16: error: conversion from ‘Shape*’ to non-scalar type ‘Shape’ requested"
Now I googled the error and found that I need to call a new Shape like this:
SHape *l = new Shape(5,5);
Am I doing something wrong, because I don't recall ever having to do that for other classes I've used before? Thanks in advance.