Results 1 to 9 of 9

Thread: basic inherited or vector problem?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default basic inherited or vector problem?

    Qt Code:
    1. class Network {
    2. private:
    3. Layer lay;
    4. .....................
    5. };
    6.  
    7. void Network::_create() {
    8. lay._ne->resize(10);
    9. }
    10. //lay.h
    11. #include "ne.h"
    12. #include <vector>
    13. class Network;
    14. class Lay {
    15. protected:
    16. std::vector <Ne>* _ne;
    17. friend Network;
    18. public:
    19. Lay();
    20. ~Lay();
    21. };
    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
    Last edited by mickey; 13th February 2007 at 01:37.
    Regards

Similar Threads

  1. Need Basic html Browser
    By awalesminfo in forum Newbie
    Replies: 6
    Last Post: 21st March 2006, 17:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.