Q:

C++ - function that returns object

// Assume class definition for Cat is here.

Cat makeCat() {
    Cat lady = new Cat("fluffy");
    return lady;
}

int main (...) {
    Cat molly = makeCat();
    molly->eatFood(); 
    return 0;
}

Will there be a "use after free" error on molly->eatFood()?

A:

Corrected your program and created an example implementation of class Cat:
#include <iostream>
#include <string>

class Cat {
public:
        Cat(const std::string& name_ = "Kitty")
        : name(name_)
        {
                std::cout << "Cat " << name << " created." << std::endl;
        }
        ~Cat(){
                std::cout << "Cat " << name << " destroyed." << std::endl;
        }
        void eatFood(){
                std::cout << "Food eaten by cat named " << name << "." << std::endl;
        }
private:
        std::string name;
};

Cat* makeCat1() {
        return new Cat("Cat1");
}

Cat makeCat2() {
        return Cat("Cat2");
}

int main (){
        Cat kit = makeCat2();
        kit.eatFood();

        Cat *molly = makeCat1();
        molly->eatFood();
        delete molly;

        return 0;
}

It will produce the output:
Cat Cat2 created.
Food eaten by cat named Cat2.
Cat Cat1 created.
Food eaten by cat named Cat1.
Cat Cat1 destroyed.
Cat Cat2 destroyed.

I suggest you learn a basic book about the C++ cover to cover before continuing.

A:

new Cat("fluffy") creates a pointer. You will need to specify Cat* as return type. Since the object is created in heap, it will still be available after the function returned.

A:

There is no error as far as invalid use of memory other than a memory leak at the end of your program.  If something is created on the heap (such as with new) then you need to call delete on it to free it.
You also have a lot of syntax errors, corrected below.
Cat* makeCat() 
{
  Cat *lady = new Cat("fluffy");
  return lady;
}

int main (int argc, char** argv) 
{

  Cat* molly = makeCat();
  molly->eatFood(); 

  delete molly;//This was added
  return 0;
}

