CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Threaded View

  1. #1
    Join Date
    Dec 2010
    Posts
    27

    std::vector class with functions?

    I have a typedef std::vector that I'd like to expand to have a function that will seek members with a specific value in a variable. I currently have something like
    Code:
    class MyClass {
         public:
         int a;
    };
    
    typedef std::vector<MyClass> MyClassArr;
    How could I have the MyClassArr type have additional functions?
    Thank you in advance.

    EDIT:
    I believe I figured it out.
    Code:
    class MyClass {
         public:
         int a;
    };
    
    class MyClassArr:public std::vector<MyClass> {
         void func();
    };
    Last edited by lawl_rock; January 19th, 2011 at 12:43 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured