I've got a method both in the bottom class and also the derived class. After I refer to this as method with an object within the derived class it calls the bottom class method and never the derived class method. Here's my code:

Person.h

class Person
{
...
public:
...
    virtual void coutPerson();
};

Person.cpp

void Person::coutPerson() {
    cout << name << endl;
    birthday.coutDate();
    phoneNumber.coutPhoneNumber();
    cout << city << ", " << state << endl;
}

Student.h

class Student : public Person
{
...
public:
...
    virtual void coutPerson();
};

Student.cpp

void Student::coutPerson() {
    cout << "DEBUG: Student::coutPerson()" << endl;
    //Person::coutPerson();
    cout << "Dorm Room: " << this->dorm << " " << this->dormRoom << endl;
}

Object produced at: addPerson<Student>(personVector); When object is produced it's produced like a Student since it calls a student construtor. Method known as at: personVector[num-1].coutPerson(); A Student object may be the one being told to coutPerson since it is exhibiting the data which i gave it after i produced a student object.

template<typename T> void addPerson(vector<Person> &personVector) {
    T p;
    personVector.push_back(p);
}

Once the coutPerson() technique is known as on the Student object it only couts the title, birthday, phoneNumber, and city &lifier condition. What's wrong with this particular code? It ought to be calling a student coutMethod...

Thanks!

You're most likely copying the Student resist a Person object sooner or later, resulting in the Object Slicing Problem. For instance you might be storing these questions vector<Person>. You should utilize a pointer or reference rather than copying the item.

To describe why this can be a problem, you have to understand that a vector does not keep actual object you pass into it in push_back, it stores a copy from the object. Whenever you copy a Student to some Person, the copy is not a Student any longer.

Your personVector consists of Person objects. Not references to Person objects, but actual Person objects. Whenever you "place your Student object in to the vector", what really happens would be that the vector constructs a new Person object, that is copy-initialized using the Student object you allow into it, that's, it produces a copy from the Person area of the Student object. This behavior is also called "slicing".

Since there's no Student object within the vector, only a Person object, it is no wonder that calling coutPerson onto it calls Person::coutPerson, not Student::coutPerson.

If you would like polymorphic behavior, you need to store pointers (ideally wise pointers like shared_ptr or unique_ptr) within the container. Note however the object p you built inside your function is destroyed on return, so for that resist survive (so you'll have a pointer into it) you need to allocate it with new.

The functions are fine. You are either calling coutPerson from an item of type Person, or calling it from the inside Person's constructor/destructor (thanks @celtschk).
You ought to be calling using a pointer or reference for an object of type Person. That's the way you obtain polymorphism.