#include #include #include using namespace std; void sayYooHoo(); class Wire{ int x; }; class Transistor{ int x, y; string type; Wire w; public: Transistor():type("xxx"),x(-1),y(-1){} Transistor(string s, int a, int b):type(s),x(a),y(b){} void print(){ cout << " type = " << type << endl; cout << " location = " << x << " " << y << endl; } ~Transistor(){ cout << "IN DESTRUCTOR DESTROYING "<< this->type << endl; } friend ostream& operator<<(ostream &c, Transistor t); }; ostream& operator<<(ostream &c, Transistor t){ c << t.type << endl; c << t.x << " " << t.y << endl; return c; } void main() { //int i = 3; same as below int i(3); Transistor T("pnp",10,10), T2("npn",10,50), T3; cout << T << endl; sayYooHoo(); cout << T2 << endl; cout << T3 << endl; ofstream f; f.open("test.txt"); f << T << endl; f.close(); } void sayYooHoo(){ cout << "YooHoo" << endl; }