diff --git a/animals/animal.cpp b/animals/animal.cpp index 6745215..6923872 100644 --- a/animals/animal.cpp +++ b/animals/animal.cpp @@ -2,6 +2,51 @@ using namespace std; +Animal::Animal(float weight_ ,int numof_limbs_) { + weight = weight_; + numof_limbs = numof_limbs_; +} +Insects::Insects(float weight_ ,int numof_limbs_, int numof_wings_) : Animal(weight_ ,numof_limbs_){ + numof_wings = numof_wings_; +} +Beatle::Beatle(float weight_,int numof_limbs_,int numof_wings_,int numof_mustache_) : Insects(weight_ ,numof_limbs_,numof_wings_){ + numof_mustache = numof_mustache_; +} +ButterFly::ButterFly(float weight_,int numof_limbs_,int numof_wings_,string colorof_wings_) : Insects(weight_ ,numof_limbs_,numof_wings_){ + colorof_wings = colorof_wings_; +} + +Animal::~Animal() {} + +string Animal::about() const { + stringstream ss; + ss << "Weight = " << weight << '\n' << "Number of Limbs = " << numof_limbs; + return ss.str(); +} + +string Insects::about() const { + stringstream ss; + ss << Animal::about() << '\n' << "Number of wings = " << numof_wings; + return ss.str(); +} + +string Beatle::about() const { + stringstream ss; + ss << Insects::about() << '\n' << "Number of mustache = " << numof_mustache; + return ss.str(); +} + +string ButterFly::about() const { + stringstream ss; + ss << Insects::about() << '\n' << "Color of wings = " << colorof_wings; + return ss.str(); +} + int main() { + Beatle dungbeetle(0.002,6,4,2); + ButterFly cupidinidae(0.000001,6,4,"Blue"); + cout << "Cupidinidae:" << '\n' << cupidinidae.about(); + cout << '\n'; + cout << "Dungbeatle:" << '\n' < +#include +#include +using namespace std; class Animal { -public: +private: float weight; // kg + int numof_limbs; +protected: + Animal(float weight_ ,int numof_limbs_); + virtual ~Animal(); +public: + float getWeight() const { return weight; } + void setWeight(float newValue) { weight = newValue; } + int getNumofLimbs() const { return numof_limbs; } + void setNumofLimbs(int newValue) { numof_limbs = newValue; } + virtual std::string about() const; }; -class Mammal : public Animal { +class Insects : public Animal{ +private: + int numof_wings; +protected: + Insects(float weight_ ,int numof_limbs_, int numof_wings_); public: + int getNumofWings() const { return numof_wings; } + void setNumofWings(int newValue) { numof_wings = newValue; } + virtual std::string about() const; + +}; + +class Reptilies : public Animal{ +private: + bool isShell; + float tongueLength; //meters +}; + +class Mammal : public Animal { +private: float pregnancyDuration; // days + int numof_niples; +}; + +class Beatle : public Insects{ +private: + int numof_mustache; +public: + int getNumofMustache() const { return numof_mustache; } + void setNumofMustache(int newValue) { numof_mustache = newValue; } + virtual std::string about() const; + Beatle(float weight_,int numof_limbs_,int numof_wings_,int numof_mustache_); }; -class Cat : public Mammal { +class ButterFly : public Insects{ +private: + string colorof_wings; public: + string getColorofWings() const { return colorof_wings; } + void setColorofWings(string newValue) { colorof_wings = newValue; } + virtual std::string about() const; + ButterFly(float weight_,int numof_limbs_,int numof_wings_,string colorof_wings_); +}; + +class Snake : public Reptilies{ +private: + bool isPoisonous; +}; + +class Turtle : public Reptilies{ +private: + float shellStrength; //kg +}; + +class Cat : public Mammal{ +private: float vibrissaLength; // meters }; + +class Dog : public Mammal{ +private: + float dobermanLength; // meters +}; + +inline std::ostream& operator <<(std::ostream& os, const Beatle& beatle) { + return os << beatle.about(); +} + +inline std::ostream& operator <<(std::ostream& os, const ButterFly& bttfly) { + return os << bttfly.about(); +} diff --git a/electricity/electricity.cpp b/electricity/electricity.cpp index 9f1c017..24bef49 100644 --- a/electricity/electricity.cpp +++ b/electricity/electricity.cpp @@ -5,44 +5,148 @@ using namespace std; bool Object::isConnectedTo(const Object& other) const { + size_t n = (this)->getPoleCount(); + for(size_t i = 0;i < n;i++){ + if(((this->getPole(i+1))->connectedObject) == &other) return true; + } // TODO return false; } bool Object::connect(const std::string& poleName, const Object& other, const std::string& otherPoleName) { - // TODO - return false; + if(this->isConnectedTo(other)) return false; + else { + //disconnect to this + Object* nowConnectThis = (this->getPole(poleName))->connectedObject; + string nwCnctThs = (this->getPole(poleName))->connectedObjectPole; + if (nowConnectThis != nullptr) { + (nowConnectThis->getPole(nwCnctThs))->connectedObject = nullptr; + (nowConnectThis->getPole(nwCnctThs))->connectedObjectPole = ""; + (this->getPole(poleName))->connectedObject = const_cast(&other); + (this->getPole(poleName))->connectedObjectPole = otherPoleName; + } //connect to this + else { + (this->getPole(poleName))->connectedObject = const_cast(&other); + (this->getPole(poleName))->connectedObjectPole = otherPoleName; + } + + //disconnect to other + Object* nowConnectOther = (other.getPole(otherPoleName))->connectedObject; + string nwCnctOthr = (other.getPole(otherPoleName))->connectedObjectPole; + Pole* othr = const_cast(other.getPole(otherPoleName)); + if (nowConnectOther != nullptr){ + (nowConnectOther->getPole(nwCnctOthr))->connectedObject = nullptr; + (nowConnectOther->getPole(nwCnctOthr))->connectedObjectPole = ""; + othr->connectedObject = this; + othr->connectedObjectPole = poleName; + } //connect to other + else{ + othr->connectedObject = this; + othr->connectedObjectPole = poleName; + } + + return true; + } } Switch::Switch(const std::string& name) : Object(name) - , a1("A1") - , a2("A2") + , s1("S1") + , s2("S2") +{ +} + +Lamp::Lamp(const std::string& name) + :Object(name) + , l1("L1") + , l2("L2") +{ +} + +Generator::Generator(const std::string& name) + :Object(name) + , p("Plus") + , m("Minus") + , g("Ground") { } const Pole* Switch::getPole(const string& name) const { - if (name == a1.name) - return &a1; - if (name == a2.name) - return &a2; + if (name == s1.name) + return &s1; + if (name == s2.name) + return &s2; + return nullptr; +} +const Pole* Lamp::getPole(const string& name) const +{ + if (name == l1.name) + return &l1; + if (name == l2.name) + return &l2; + return nullptr; +} +const Pole* Generator::getPole(const string& name) const +{ + if (name == p.name) + return &p; + if (name == m.name) + return &m; + if (name == g.name) + return &g; return nullptr; } - const Pole* Switch::getPole(size_t idx) const { + if (idx == 1) + return &s1; + if (idx == 2) + return &s2; // TODO return nullptr; } +const Pole* Lamp::getPole(size_t idx) const +{ + if (idx == 1) + return &l1; + if (idx == 2) + return &l2; + // TODO + return nullptr; +} +const Pole* Generator::getPole(size_t idx) const +{ + if (idx == 1) + return &p; + if (idx == 2) + return &m; + if (idx == 3) + return &g; + return nullptr; +} + + int main() { Switch sw, sw2; - sw.connect("A2", sw2, "A1"); + sw.connect("S2", sw2, "S1"); cout << "is " << (sw.isConnectedTo(sw2) ? "" : "not ") << "connected" << endl; + Switch sw0; + Lamp l; + Generator g; + sw0.connect("S1", l,"L1"); + l.connect("L2",g,"Plus"); + g.connect("Minus",sw0,"S2"); + if(sw0.isConnectedTo(g) && sw0.isConnectedTo(l)) cout << "Switch is connected\n"; + else cout << "Switch is not connected"; + if(l.isConnectedTo(g) && l.isConnectedTo(sw0)) cout << "Lamp is connected\n"; + else cout << "Lamp is not connected"; + if(g.isConnectedTo(l) && g.isConnectedTo(sw0)) cout << "Generator is connected\n"; + else cout << "Generator is not connected"; // TODO: создать цепь из генератора, выключателя и светильника return 0; diff --git a/electricity/electricity.h b/electricity/electricity.h index f7df29c..a798754 100644 --- a/electricity/electricity.h +++ b/electricity/electricity.h @@ -7,7 +7,7 @@ class Object; /// Полюс устройства. /// К одному полюсу может быть подключен один любой другой полюс этого же /// устройства, или же любой полюс любого другого устройства. -/// +/// /// У каждого полюса есть своё название, которое получает значение по умолчанию /// при создании устройства, но может быть изменено позднее. /// @@ -50,8 +50,8 @@ class Object { /// /// Индекс полюса, от 0 до значения, возвращаемого . /// Полюс с указанным индексом, или nullptr, если такой полюс не существует. - Pole* getPole(size_t idx) { /* TODO */ return nullptr; } - + //Pole* getPole(size_t idx) { /* TODO */ return nullptr; } + Pole* getPole(size_t idx) {return const_cast(const_cast(this)->getPole(idx));} /// /// Возвращает полюс по внутреннему индексу устройства. /// @@ -109,7 +109,7 @@ class Object { /// class Switch : public Object { public: - Pole a1, a2; + Pole s1, s2; Switch(const std::string& name = ""); @@ -120,7 +120,30 @@ class Switch : public Object { protected: virtual const Pole* getPole(size_t idx) const; }; +class Lamp : public Object { +public: + Pole l1, l2; + + Lamp(const std::string& name = ""); + virtual size_t getPoleCount() const { return 2; } + + virtual const Pole* getPole(const std::string& name) const; +protected: + virtual const Pole* getPole(size_t idx) const; +}; // TODO: класс светильника с двумя полюсами +class Generator : public Object { +public: + Pole p,m,g; + + Generator(const std::string& name = ""); + + virtual size_t getPoleCount() const { return 3; } + virtual const Pole* getPole(const std::string& name) const; + +protected: + virtual const Pole* getPole(size_t idx) const; +}; // TODO: класс генератора с тремя полюсами (фаза, нейтраль, земпя). diff --git a/memhacks/memhacks.cpp b/memhacks/memhacks.cpp index 514c868..b0f04c1 100644 --- a/memhacks/memhacks.cpp +++ b/memhacks/memhacks.cpp @@ -7,6 +7,22 @@ B::B() : b_s("It's b!") { for (auto i = 0; i < sizeof(data) / sizeof(data[0]); i++) data[i] = i * 2; } +A::A() : a_s("It's a!") { } + +std::string A::geta_s(){return a_s;} +std::string B::getb_s(){return b_s;} +float B::getdata(int i){return data[i];} +void A::aAbout(std::ostream& os){ + os << "a_s is - " << geta_s() << '\n'; +} +void B::bAbout(std::ostream& os){ + os << "b_s is -" << getb_s() << '\n'; + os << "data = "; + for(int i = 0;i < 7;i++){ + os << getdata(i) << ' '; + } +} + /// /// Выводит на экран адреса и размеры объекта типа и его содержимого. @@ -16,6 +32,7 @@ B::B() : b_s("It's b!") { void printInternals(const B& b) { const A* a = &b, * a2 = a + 1; cout << "Address of b is 0x" << &b << ", address of b.a_s is 0x" << &b.a_s << ", address of b.b_s is 0x" << &b.b_s << endl; + cout << "Address of data is 0x" << b.data << endl; cout << "Size of A is " << sizeof(A) << ", size of B is " << sizeof(B) << endl; cout << "B string is '" << b.getBString() << "'" << endl; //cout << "B data: "; b.printData(cout); cout << endl; @@ -26,10 +43,23 @@ void printInternals(const B& b) { /// Подразумевается, что текущий объект на самом деле представлено классом . /// /// Значение B::b_s + std::string A::getBString() const { + return *((const std::string *)(this+1)); + // TODO +} + +float A::getBData(int idx) const{ + return *(((const float *)(this+1))+8+idx); +} + +std::string A::getAString() const { + return *((const std::string *)((const char *)(this+1)-8)-1); // TODO } + + /// /// Извлекает значения , и /// из текущего объекта и выводит их в текстовом виде в указанный выходной поток @@ -38,6 +68,12 @@ std::string A::getBString() const { /// void A::printData(std::ostream& os) { // TODO + os << "a_s is - " << getAString() << '\n'; + os << "b_s is - " << getBString() << '\n'; + os << "data = " << ' '; + for(int i = 0;i < 7;i++){ + os << getBData(i) << ' '; + } } /// @@ -45,13 +81,22 @@ void A::printData(std::ostream& os) { /// из текущего объекта и выводит их в текстовом виде в указанный выходной поток /// с помощью виртуальных функций, предусмотренных в классе . /// -void A::printData2(std::ostream& os) { - // TODO + +void B::printData2(std::ostream& os) { + aAbout(os); + bAbout(os); } + int main() { + A a; B b; - printInternals(b); + b.printData(std::cout); + cout << '\n'; + b.printData2(std::cout); + //printInternals(b); + //cout << sizeof(char); + return 0; } diff --git a/memhacks/memhacks.h b/memhacks/memhacks.h index 51076b5..93524c1 100644 --- a/memhacks/memhacks.h +++ b/memhacks/memhacks.h @@ -12,9 +12,17 @@ class A { friend void printInternals(const B&); public: - std::string getBString() const; + A(); + + std::string geta_s(); + virtual void aAbout(std::ostream& os); + + int getbefore() const; + float getBData(int idx) const; + std::string getBString() const ; + std::string getAString() const ; + std::string* getBString_adr() const; void printData(std::ostream& os); - void printData2(std::ostream& os); }; class B : public A { @@ -24,6 +32,12 @@ class B : public A { friend void printInternals(const B&); public: + + void printData2(std::ostream& os); + virtual void bAbout(std::ostream& os); + std::string getb_s(); + float getdata(int i); + B(); }; diff --git a/memhacks/newhacks.cpp b/memhacks/newhacks.cpp index ba359c6..f32f738 100644 --- a/memhacks/newhacks.cpp +++ b/memhacks/newhacks.cpp @@ -1,9 +1,81 @@ #include -#include "memhacks.h" +#include "newhacks.h" using namespace std; +Foo::Foo(): apples("Apples"){ + n = 10; + cerr << "Foo object is constructed " << apples << " at " << this << endl; +} +Foo::~Foo(){ + cerr << "Foo object is destructed " << apples << " at " << this << endl; +} +void* Foo::operator new[](size_t size /* размер в байтах */){ + auto p = malloc(size); // ::operator new(size); + cerr << "Foo's operator new[](" << size << ") " << " works " << "and returns " << p << endl; + return p; +} +void Foo::operator delete[](void *p){ + cerr << "Foo operator delete[](" << p << ")" << " works" << endl; + free(p); // ::operator delete(p); +} + + + +Bar::Bar(): oranges("Oranges"){ + kg = 3.5; + cerr << "Bar object is constructed " << oranges << " at " << this << endl; +} +Bar::~Bar(){ + cerr << "Bar object is destructed " << oranges << " at " << this << endl; +} +void* Bar::operator new[](size_t size /* размер в байтах */){ + auto p = malloc(size); // ::operator new(size); + cerr << "Bar's operator new[](" << size << ") " << " works " << "and returns " << p << endl; + return p; +} +void Bar::operator delete[](void *p){ + cerr << "Bar's operator delete[](" << p << ")" << " works" << endl; + free(p); // ::operator delete(p); +} + + +Buz::Buz(): bananas("Bananas"){ + ripe = true; + cerr << "Buz object is constructed " << bananas << " at " << this << endl; +} + +Buz::~Buz(){ + cerr << "Buz object is destructed " << bananas << " at " << this << endl; +} + + + int main() { + //на стеке + Foo apls1,apls2; + Bar orng1,orng2;//вызывается также конструктор и диструктор родительского класса + Buz bnns1,bnns2;//вызывается также конструктор и диструктор родительского класса + //диструктор вызвается в после исполнения программы + cout << '\n'; + //в динамической памяти + Foo *apple1 = new Foo; + delete apple1; + Bar *orange1 = new Bar; //вызывается оператор new - родттельского класса ---> оператор new наследника + delete orange1; //вызывается оператор оператор delete наследника ---> оператор delete - родттельского класса + + //Buz *bananas1 = new Buz;// запретили создание в динамической памяти + //delete bananas1; + cout << '\n'; + //общее то что при уничтожении наследни --> родитель + //при создании родитель --> наследник + Foo *apples2 = new Foo[4]; //происходит последовательный вызов конструктора + delete apples2; // последовательный вызов диструктора + Bar *oranges2 = new Bar[4]; + delete oranges2; + //Buz *bananas2 = new Buz[4]; - не перегружали + //delete bananas2; + cout << '\n'; return 0; } diff --git a/memhacks/newhacks.h b/memhacks/newhacks.h index 079a383..5664024 100644 --- a/memhacks/newhacks.h +++ b/memhacks/newhacks.h @@ -1,2 +1,41 @@ #pragma once +#include +#include + +class Foo +{ + std::string apples; + int n; + +public: + Foo(); + ~Foo(); + + static void* operator new[](size_t size); + static void operator delete[](void *p); +}; + +class Bar : public Foo{ + std::string oranges; + float kg; + +public: + Bar(); + ~Bar(); + + static void* operator new[](size_t size); + static void operator delete[](void *p); +}; + +class Buz : public Foo{ + std::string bananas; + bool ripe; + static void* operator new[](size_t size); + static void* operator new(size_t size); +public: + Buz(); + ~Buz(); + + static void operator delete[](void *p); +}; diff --git a/vectors/vector.cpp b/vectors/vector.cpp index 9777069..e01462a 100644 --- a/vectors/vector.cpp +++ b/vectors/vector.cpp @@ -6,13 +6,89 @@ using namespace std; ostream& operator <<(ostream& os, const vector3d& v) { return os << "{ " << v[0] << ", " << v[1] << ", " << v[2] << " }"; } +vector3d vector3d::operator+(vector3d const &v){ + return vector3d(data[0]+v.data[0],data[1]+v.data[1],data[2]+v.data[2]); +} +vector3d vector3d::operator-(vector3d const &v){ + return vector3d(data[0]-v.data[0],data[1]-v.data[1],data[2]-v.data[2]); +} +vector3d operator*(vector3d const &v,float const &d){ + return vector3d(v.data[0]*d,v.data[1]*d,v.data[2]*d); +} +vector3d operator/(vector3d const &v,float const &d){ + return vector3d(v.data[0]/d,v.data[1]/d,v.data[2]/d); +} +vector3d operator*(float const &d,vector3d const &v){ + return vector3d(v.data[0]*d,v.data[1]*d,v.data[2]*d); +} +vector3d vector3d::operator-(){ + return vector3d(-data[0],-data[1],-data[2]); +} +vector3d vector3d::operator!(){ + return vector3d(!data[0],!data[1],!data[2]); +} +bool test_vector3d(vector3d v1,vector3d v2,float d) { + bool res = true; + if( ((v1+v2)[0] != v1[0] + v2[0]) || ((v1+v2)[1] != v1[1] + v2[1]) || ((v1+v2)[2] != v1[2] + v2[2]) ){ + res = false; + cerr << "Сложение (+) выполнено неверно для:\n" << v1 << '\n' << v2 << '\n'; + } + if( ((v1-v2)[0] != v1[0] - v2[0]) || ((v1-v2)[1] != v1[1] - v2[1]) || ((v1-v2)[2] != v1[2] - v2[2]) ){ + res = false; + cerr << "Вычитание (-) выполнено неверно для:\n" << v1 << '\n' << v2 << '\n'; + } + if( ((v1*d)[0] != v1[0]*d) || ((v1*d)[1] != v1[1]*d) || ((v1*d)[2] != v1[2]*d) ){ + res = false; + cerr << "Умножение на скаляр (*) выполнено неверно для:\n" << v1 << '\n' << d <<'\n'; + } + if( ((d*v1)[0] != v1[0]*d) || ((d*v1)[1] != v1[1]*d) || ((d*v1)[2] != v1[2]*d) ){ + res = false; + cerr << "Умножение на скаляр (*) выполнено неверно для:\n" << v1 << '\n' << d <<'\n'; + } + if( ((v2*d)[0] != v2[0]*d) || ((v2*d)[1] != v2[1]*d) || ((v2*d)[2] != v2[2]*d) ){ + res = false; + cerr << "Умножение на скаляр (*) выполнено неверно для:\n" << v2 << '\n' << d <<'\n'; + } + if( ((d*v2)[0] != v2[0]*d) || ((d*v2)[1] != v2[1]*d) || ((d*v2)[2] != v2[2]*d) ){ + res = false; + cerr << "Умножение на скаляр (*) выполнено неверно для:\n" << v2 << '\n' << d <<'\n'; + } + if( ((v1/d)[0] != v1[0]/d) || ((v1/d)[1] != v1[1]/d) || ((v1/d)[2] != v1[2]/d) ){ + res = false; + cerr << "Деление на скаляр (/) выполнено неверно для:\n" << v1 << '\n' << d <<'\n'; + } + if( ((v2/d)[0] != v2[0]/d) || ((v2/d)[1] != v2[1]/d) || ((v2/d)[2] != v2[2]/d) ){ + res = false; + cerr << "Деление на скаляр (/) выполнено неверно для:\n" << v2 << '\n' << d <<'\n'; + } + if( ((-v1)[0] != -v1[0]) || ((-v1)[1] != -v1[1]) || ((-v1)[2] != -v1[2]) ){ + res = false; + cerr << "Взятие обратного знака (-) выполнено неверно для:\n" << v1 << '\n'; + } + if( ((-v2)[0] != -v2[0]) || ((-v2)[1] != -v2[1]) || ((-v2)[2] != -v2[2]) ){ + res = false; + cerr << "Взятие обратного знака (-) выполнено неверно для:\n" << v2 << '\n'; + } + if( ((!v1)[0] != (!v1[0])) || ((!v1)[1] != (!v1[1])) || ((!v1)[2] != (!v1[2])) ){ + res = false; + cerr << "Операция инверсии (!) выполнено неверно для:\n" << v1 << '\n'; + } + if( ((!v2)[0] != !v2[0]) || ((!v2)[1] != !v2[1]) || ((!v2)[2] != !v2[2]) ){ + res = false; + cerr << "Операция инверсии (!) выполнено неверно для:\n" << v2 << '\n'; + } + + return res; +} + + int main(int argc, char** argv) { vector3d v1, v2(12), v3(1, 3, 8); - v1[2] = 54; //vector3d v4 = v1 + v2, v5 = v1 - v2, v6 = v1 * 0.5f; //cout << "v4: " << v4 << endl << "v5: " << v5 << endl << "v6: " << v6 << endl; + /* printf("address of v1: 0x%p, size: %zu bytes\n", &v1, sizeof(v1)); printf("address of v1.data: 0x%p, size: %zu bytes\n", &v1.data, sizeof(v1.data)); printf("address of v1.data[-1]: 0x%p, size: %zu bytes\n", &v1.data[-1], sizeof(v1.data[-1])); @@ -20,6 +96,20 @@ int main(int argc, char** argv) { printf("address of v1.data[1]: 0x%p, size: %zu bytes\n", &v1.data[1], sizeof(v1.data[1])); printf("address of v1.data[2]: 0x%p, size: %zu bytes\n", &v1.data[2], sizeof(v1.data[2])); printf("address of v1.data[2000]: 0x%p, size: %zu bytes\n", &v1.data[2000], sizeof(v1.data[2000])); - - return 0; + */ + cout << "v3 = " << v3 << '\n'; + cout << "v2 = " << v2 << '\n'; + cout << "v1 = " << v1 << '\n' << '\n'; + vector3d v = v3 + v2; + cout << "v3 + v2 : " << v << '\n'; + v = v3 - v2; + cout << "v3 - v2 : " << v << '\n'; + cout << "v3*2 : " << v3*2 << '\n'; + cout << "2*v3 : " << 2*v3 << '\n'; + cout << "v3/2 : " << v3/2 << '\n'; + cout << "-v3 : " << -v3 << '\n'; + cout << "!v3 : " << !v3 << '\n'; + cout << "!v1 : " << !v1 << '\n'; + if(test_vector3d(v1,v2,8)) { return 0; } + else { return 1; } } diff --git a/vectors/vector.h b/vectors/vector.h index 07587fb..413ffac 100644 --- a/vectors/vector.h +++ b/vectors/vector.h @@ -12,7 +12,13 @@ class vector3d { float& operator[](int idx) { return data[idx]; } float operator[](int idx) const { return data[idx]; } - + vector3d operator+(vector3d const &v); + vector3d operator-(vector3d const &v); + friend vector3d operator*(vector3d const &v,float const &d); + friend vector3d operator*(float const &d,vector3d const &v); + friend vector3d operator/(vector3d const &v,float const &d); + vector3d operator-(); + vector3d operator!(); friend int main(int argc, char** argv); };