Thread: how do I pass in a string to the object's constructor

  1. #1
    Registered User
    Join Date
    Dec 2017
    Posts
    37

    how do I pass in a string to the object's constructor

    sorry kinda new
    Code:
    #include "stdafx.h"
    #include <iostream>
    #include <fstream>
    #include <vector>
    using namespace std;
    
    template<class gamer>
    class game
    {
    private:
    
    protected:
        int nintendo;
        int sega;
        string fun;
        bool enjoy;
    public:
    
    };
    
    ostream & operator ( ostream & out, const game);
    
    template<class gamer>
    class game2 : public game<gamer>
    {
    private:
        string joy;
        string jello;
    protected:
    
    public:
        void vjello(string joy_in)
        {
            jello = joy_in;
        }
        string sjoy()
        {
            return jello;
        }
        vector<cookies> gamingg(5);
        Tasty();
        Delicious();
        Yummy();
        Hungry();
        Full();
    };
    
    int main()
    {
        
    
    }

  2. #2
    Registered User
    Join Date
    Dec 2017
    Posts
    1,626
    Your code is meaningless.
    A little inaccuracy saves tons of explanation. - H.H. Munro

  3. #3
    Registered User
    Join Date
    Jun 2017
    Posts
    157
    People tried to figure out what he / she wants without success here:
    http://www.cplusplus.com/forum/general/235169/

  4. #4
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,739
    Guys, in case you haven't figured it out yet, this is how programmers troll other programmers. Please let it starve.
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pass array directly to new object
    By a.mlw.walker in forum C++ Programming
    Replies: 3
    Last Post: 06-14-2013, 03:03 PM
  2. trying to pass an array of object
    By kdun in forum C++ Programming
    Replies: 10
    Last Post: 04-25-2013, 06:19 AM
  3. DLL Global Object Constructor String Error
    By n00b3 in forum Windows Programming
    Replies: 1
    Last Post: 06-29-2008, 07:42 PM
  4. Pass object to function
    By swgh in forum C++ Programming
    Replies: 10
    Last Post: 05-26-2008, 07:57 AM
  5. how to pass an ifstream object to a function
    By chintugavali in forum C++ Programming
    Replies: 14
    Last Post: 12-18-2007, 09:58 PM

Tags for this Thread