This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FW: gcc test


Hi Mike,

Try this...

---tst.cpp---
#include <iostream>
    using std::cout;
#include "blackbox.h"

int main()
{
    cout << "Hello, ";
    BlackBox::Mike();
    cout << "Hello, ";
    BlackBox::Michael();
}
---eof---

---blackbox.h---
class BlackBox
{
public:
    static void Mike();
    static void Michael();
};
---eof---

---blackbox.cpp---
#include <iostream>
    using std::cout;
    using std::endl;

void BlackBox::Mike()
{
    cout << "Mike" << endl;
}

void BlackBox::Michael()
{
    cout << "Michael" << endl;
}
---eof---

Compile/link via:
g++ -o myblackbox tst.cpp blackbox.cpp

HTH,
--Eljay

[Second try, in non-HTML this time.]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]