Please consider this example:
#include <bits/stdc++.h>
using namespace std;
class Example{
private:
int var1;
Example *oak;
};
is alright but not this
#include <bits/stdc++.h>
using namespace std;
class Example{
private:
int var1;
Example oak;
};
Why having a pointer to the same class object as member variable is okay but not the class object itself as a member variable?
Can you give me some practical cases where having a same class object as member variable is useful?