0

I am trying to pass an object to a function. I got two errors from the function declaration in car.h I am using vs2019, VC++.

overloaded function "Car::Car" is not a type name
syntax error: identifier '{ctor}' <<<<< about the object named car

Engine class

class Engine {
    protected:
        // some variables

    public:
        // default constructor and destructor
        // some function
};

SUV class

class SUV : public Engine {
    protected:
        // some variables

    public:
        // default constructor and deconstructor
        // some function
};

Car class

class Car : public SUV {
    public:
        Car();
        ~Car();
};

Factory class

class Factory {
    public:
        void MakeCar( int x, Car::Car car ); <<<<<< Errors

I really don't know why it doesn't work. Please tell me. Thank you.

0 Answers0