Here I am trying to push an object into a vector using push\_back function and rvalue of that object. Look at the `addMovie()` function of the `Movies` class below

```
#include "Movies.h"

void Movies::addMovie(std::string name, std::string rating, int watched)
{

    movieColl.push_back(Movie{name,rating,watched});           //apparently I am having problem here

}

```

Rest of the required parts are here

```
class Movies
{
    public:
        void addMovie(std::string name, std::string rating, int watched);

    protected:

    private:
        std::vector <Movie> movieColl;

};

```

Movie class itself... I have just showed constructors here although I have implemented the other functions

```
class Movie
{
    public:
        Movie(std::string name,std::string rating, int watched = 0);
        Movie(const Movie &obj);

        Movie();

        void getMovieDetails();
        void addToWatchTime(int num = 1);
        void setMovieDetails(std::string name,std::string rating, int watched = 0);

    protected:

    private:
        std::string name;
        std::string rating;
        int watched;
};

Movie::Movie(std::string name,std::string rating, int watched):name{name},rating{rating},watched{watched}
{
    //ctor

}

Movie::Movie(const Movie &obj):Movie(obj.name,obj.rating,obj.watched){}

Movie::Movie():Movie("None","NA",0){} 

```

My MAIN Function

```
#include<iostream>

#include"Movies.h"

using namespace std;

int main()
{

    Movies collection;

    collection.addMovie("GG","PG",343);

    return 0;
}

```