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

Thread: an issue about obj. oriented programming

  1. #1
    Join Date
    Mar 2018
    Posts
    37

    an issue about obj. oriented programming

    Hello
    I need an alternative way to describe the following vector for using in the base class, because for inheritance, I must put a vector inside a base class and then it will call automatically in the derived class, but for this vector, I will have an error on (4,0)
    Code:
    std::vector<int> bit(4,0);
    how I can solve it?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,223

    Re: an issue about obj. oriented programming

    Just split the declaration and implementation.
    in the header:
    Code:
    std::vector<int> bit;
    and in the base class ctor:
    Code:
     bit.assign(4,0);
    Victor Nijegorodov

Tags for this Thread

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)