Coggle requires JavaScript to display documents.
delete
new[]
delete[]
malloc
calloc
free()
nullptr
shared_ptr
use_count()
unique_ptr
move()
// Konstruktorok string() // üres string (""); string(const string& str); string(const char* s);
[]
size_t at(size_t pos)
find()
find_first_of()
find_first_not_of()
find_last_of()
find_last_not_of()
return *this
class MyClass { int a; public: friend MyClass operator+(const MyClass& other) { return { a + other.a } } };
class MyClass { int x, y; public: MyClass() : MyClass(42), y(10) {} // HIBÁS, de az y(10) nélkül jó lenne MyClass(int v) : x(v), y(v + 1) {} };
class MyClass { int y, x; public: MyClass() : y(10), x(y) {} }; // ezesetben az x inicializálatlan // így a cout memóriaszemetet ír ki
class MyClass { public MyClass() = delete; };
class MyClass { const int getA() {} // << nem ez az int getB() const {} // << ő itt most a lényeg };
foo()
class MyClass { void foo(); void foo(int x); void foo(int x, int y); void foo(int x, int y) const; // ez is megengedett };
private
protected
public
class Child : public Parend {}
this->x
Parent::x
virtual
final
override
class Parent { public: virtual explicit operator string() const { return "Parent"; } virtual ~Parent() {} }; // destruktort is érdemes virtuálissá tenni class Child { public: explicit operator string() const override { return "Child"; } ~Child() override {} }; // override nem kötelező sehova se, de segít
int main() { Parent inst = Child(); cout static_cast<string>(inst); // eredmény: Parent return 0; }
int main() { Child inst = Child(); Parent& inst_ref = inst; cout static_cast<string>(inst_ref); // eredmény: Child return 0; }
int main() { Parent *inst = Child(); cout static_cast<string>(*inst); // eredmény: Child delete inst; return 0; }
virtual void foo() = 0;
cout << UINT_MAX + 1 << endl; // 0 (OK)
cout << INT_MAX + 1 << endl; // -2147483648 // (nem ajánlott, warningot dobhat, de nem hiba)
int main() { /* ... */ }
int main(int argc, char* argv[]) { /* ... */ }
// nem szabványos int main(int argc, char* argv[], char* env[]) { /* ... */ }
return 0