Garmaine Staff asked 1 year ago

I'm new here and I'm a student, so I'm sorry and a little patient with me. I am taking a course at Udemy on POO C ++ in which I have already taken a course on the basics in C and C ++. However, when developing the code in VS 2019, this error is occurring c2679 '>>' binary: no operator found that receives a right-hand operator of type 'function overloaded'. I have already researched and so far I have not been able to find a solution. Please, can you help me I will be grateful. Here is a bass or code:

#include <iostream>
#include <string>
#include <cstdlib>
#include <fstream>
#include <istream>

using namespace std;

class Carro {
        string marca;
        int ano;
        //Parametro para leitura da variavel MARCA
        void setMarca(string x) {
            marca = x;
        //Imprimir a variavel MARCA
        string getMarca() {
            return marca;

        //Parametro para leitura da variavel ANO
        void setAno(int y) {
            ano = y;
        //Imprimir a variavel ANO
        int getAno() {
            return ano;

int main()
{   //Lendo as variaveis ANO e MODELO
    Carro c1;
    cout << "Digite o nome da marca do primeiro carro: ";
    cin >> c1.setMarca;    <- Erro C2679
    cout << "Digite o ano do primeiro carro: ";
    cin >> c1.setAno;      <- Erro C2679

    //Imprimindo na tela as variaveis
    cout << "A marca do primeiro carro eh: " << c1.getMarca() << endl;
    cout << "O ano do primeiro carro eh: " << c1.getAno() << endl;

    //Pausa o programa

    return 0;