add pointer in classes
add interfaces
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "Entity.h"
|
||||
#include "Monster.h"
|
||||
#include "Vector3.h"
|
||||
#include "Ork.h"
|
||||
|
||||
using namespace MyNamespace;
|
||||
using namespace std;
|
||||
@@ -11,12 +12,29 @@ int main()
|
||||
Entity entity; // this is an instance
|
||||
cout << entity.ToString() << endl;
|
||||
|
||||
Monster monster;
|
||||
cout << monster.ToString() << endl;
|
||||
// can't be instantiated, because it is abstract
|
||||
//Monster monster;
|
||||
//cout << monster.ToString() << endl;
|
||||
|
||||
Vector3 position(1.0f, 0.0f, 2.0f);
|
||||
Vector3 position2 = Vector3();
|
||||
Vector3 position3{}; // list-initializer
|
||||
|
||||
Ork ork;
|
||||
ork.Move(position);
|
||||
|
||||
Monster* pMonster = new Ork();
|
||||
delete pMonster;
|
||||
pMonster = nullptr;
|
||||
|
||||
ICompareable* pCompareables[] = { new Ork, new Ork, new Ork };
|
||||
for (size_t i = 0; i < size(pCompareables); i++)
|
||||
{
|
||||
delete pCompareables[i];
|
||||
pCompareables[i] = nullptr;
|
||||
}
|
||||
|
||||
Ork ork2 = ork;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user