class Network {
private:
Layer lay;
.....................
};
void Network::_create() {
lay._ne->resize(10);
}
//lay.h
#include "ne.h"
#include <vector>
class Network;
class Lay {
protected:
std::vector <Ne>* _ne;
friend Network;
public:
Lay();
~Lay();
};
class Network {
private:
Layer lay;
.....................
};
void Network::_create() {
lay._ne->resize(10);
}
//lay.h
#include "ne.h"
#include <vector>
class Network;
class Lay {
protected:
std::vector <Ne>* _ne;
friend Network;
public:
Lay();
~Lay();
};
To copy to clipboard, switch view to plain text mode
Hi, I dont want use inherit for this program for my reasons.
Problems:
1. when resize is called program crash; I guess it happen because I'm working with vector of pointers...maybe they should be set to NULL (?). But how can I do this? Before resizing vector size is 0.....
2. when net.create() is executed; then why do I have to use 'class network, friend network'? (otherwise I can't access to member protected _ne). Wich is the reason? If I done a class as member I guess that I can do everything with that oblect.....
Are you understand?
Are there any other implementation of this ? (without inherit please)
thanks
Bookmarks