koala114
January 19th, 2011, 05:22 AM
#include <iostream>
namespace my{
class A {
public:
void OUTPUT();
};
class B: private A{
public:
B(){std::cout<<"hi ford";}
//using A::OUTPUT;
void OUTPUT();
};
class C: private B{
public:
C(){std::cout<<"hi C";}
//using my::B::OUTPUT;
void xxx();
};
}
#include "heritance.h"
void my::A::OUTPUT(){
std::cout<< "hhhhh";
}
void my::B::OUTPUT(){
A::OUTPUT();
}
void xxx(){
//OUTPUT();
}
#include "heritance.h"
int main(){
using namespace my;
B b;
b.OUTPUT();
return 0;
}
debian:~/src# g++ main.cpp
/tmp/ccSXkBAc.o: In function `main':
main.cpp:(.text+0x7f): undefined reference to `my::B::OUTPUT()'
collect2: ld returned 1 exit status
namespace my{
class A {
public:
void OUTPUT();
};
class B: private A{
public:
B(){std::cout<<"hi ford";}
//using A::OUTPUT;
void OUTPUT();
};
class C: private B{
public:
C(){std::cout<<"hi C";}
//using my::B::OUTPUT;
void xxx();
};
}
#include "heritance.h"
void my::A::OUTPUT(){
std::cout<< "hhhhh";
}
void my::B::OUTPUT(){
A::OUTPUT();
}
void xxx(){
//OUTPUT();
}
#include "heritance.h"
int main(){
using namespace my;
B b;
b.OUTPUT();
return 0;
}
debian:~/src# g++ main.cpp
/tmp/ccSXkBAc.o: In function `main':
main.cpp:(.text+0x7f): undefined reference to `my::B::OUTPUT()'
collect2: ld returned 1 exit status