Мне нужно что-то написать на C ++.У меня проблема с виртуальными функциями.
Например, в заголовочном файле Human.h
У меня есть это:
class Human
{
public:
virtual int Age();
Human();
~Human();
}
В Human.cpp
файле У меня есть:
#include<iostream>
#include "Human.h"
int Human::Age()
{
return 0;
}
Я получаю следующие ошибки компиляции:
Error 4 error C2371: 'Human::Age' : redefinition; different basic types c:\users\jan\desktop\testc\testc\human.cpp 5 1 TestC
Error 3 error C2556: 'Human Human::Age(void)' : overloaded function differs only by return type from 'int Human::Age(void)' c:\users\jan\desktop\testc\testc\human.cpp 5 1 TestC
Error 2 error C2628: 'Human' followed by 'int' is illegal (did you forget a ';'?) c:\users\jan\desktop\testc\testc\human.cpp 4 1 TestC