Hi, I'm studying 1st year game development and we have to program some stuff in C++
To make objects, so far we have always been taught to work with pointers.
for example:
Animal* animalPtr = new Animal(parameters);
however recently we have been taught that we can also make object directly, which I guess should go like
1 2
|
Animal animal(parameters);
animal.SetPosition(50,100); //or something like that
|
however when I try this C++ just doesn't give any intellisense and I can't find any functions of the animal class...
While it does work with just using
1 2
|
Animal* animalPtr = new Animal(params);
animalPtr->SetPosition(50,100);
|
1) So have I done anything wrong? How should I correctly make an object without using pointers?
2) When creating an object as datamember, is that object then created in stack or heap?
3) Also, Heap memory only gets used for objects created with the new statement, right? So in theory all datamembers are stack?
Need help asap! exams 14th of june :P
Thx alot!