FW: gcc test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux