How to make a template a private data member

This is a discussion on How to make a template a private data member within the C++ Programming forums, part of the General Programming Boards category; Not really sure how to explain this, but I will try my best. I have a class truck and in ...

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    4

    How to make a template a private data member

    Not really sure how to explain this, but I will try my best.

    I have a class truck and in class truck one of the private data members needs to be an object of linkedStackType<string>.

    What syntax would I need to make that private data member?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,773
    The usual: linkedStackType<string> is a type name, just like int.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Function in a private member of a class?
    By RealityFusion in forum C++ Programming
    Replies: 9
    Last Post: 09-02-2005, 05:42 PM
  2. why does this have private member access?
    By major_small in forum C++ Programming
    Replies: 9
    Last Post: 07-16-2004, 01:52 PM
  3. no change for private member ???
    By black in forum C++ Programming
    Replies: 7
    Last Post: 05-28-2004, 05:25 AM
  4. private data member with public set member function
    By Mario in forum C++ Programming
    Replies: 2
    Last Post: 05-28-2002, 10:53 AM
  5. Private member functions of a class.
    By Fyodorox in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2002, 05:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21