Ob.hpp
#ifndef Ob_hpp
#define Ob_hpp
#include <stdio.h>
class Ob
{
public:
Ob(void);
public:
~Ob(void);
virtual void Show()=0;
};
#endif /* Ob_hpp */
PAIR.hp
#ifndef PAIR_hpp
#define PAIR_hpp
#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include "Ob.hpp"
using namespace std;
class PAIR : public Ob
{
public:
PAIR(void);
public:
virtual ~PAIR(void);
void Show();
PAIR(int, int);
PAIR(const PAIR&);
int get_first(){return first;}
int get_second(){return second;}
void set_first(int);
void set_second(int);
PAIR& operator=(const PAIR&);
void operator>(const PAIR&);
void operator<(const PAIR&);
void operator==(const PAIR&);
void operator!=(const PAIR&);
friend istream& operator>>(istream&in, PAIR&c);
friend ostream& operator<<(ostream&out, const PAIR&c);
protected:
int first;
int second;
};
#endif /* PAIR_hpp */
Error:
Undefined symbols for architecture x86_64:
"Ob::Ob()", referenced from:
PAIR::PAIR() in PAIR.o
PAIR::PAIR(int, int) in PAIR.o
PAIR::PAIR(PAIR const&) in PAIR.o
"Ob::~Ob()", referenced from:
PAIR::~PAIR() in PAIR.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Выходят вот такие ошибки при компиляции, если оставить только Class PAIR, то есть "public Ob" убрать, то все работает.