zstenger93 / CPP

42 C++ modules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

📖 C++

Random things learned from the cpp projects

CPP 00

namespace:

gruping related declarations(functions, variables etc) together under a single name to prevent collisions if different libraries are using the same names for their variables or functions etc.

class:

a class is a user-defined type that encapsulates data and functions that operate on that data. The data and functions are combined into a single unit, and objects can be created from the class to represent instances of that unit.

private:

can be accessed only inside of the class

public:

can be accessed from anywhere, even from outside of the class

constructor: initialize the data members of the object, either way to default values or initialize to the passed parameters in the constructor. Has the same name as the class and no return type

destructor: called when the the object is being destroyed and it frees up everything what should been freed. It takes no arguments neither returns anything

ex00: simple function to convert the input into uppercase and return it.

ex01: creating a phonebook where you can:

add new contacts up to 8

search for contacts and

exit

ex 02:

here you need to recreate the account file based on the test and the way you can do it will be similiar the way to create the phonebook, but of course a bit different.

CPP 01

ex00: Creating a zombie

ex01: creating a horde of zombies

ex02:

CPP 02

By overloading operators, you can make your classes behave like built-in types and define intuitive and concise syntax for operations on objects of your class.

To overload an operator, you define a special member function or a global function that has the same name as the operator you want to overload. The syntax for overloading operators depends on whether you are overloading them as member functions or as global functions.

Ad-hoc polymorphism, also known as function overloading or method overloading, is a feature in programming languages that allows multiple functions or methods with the same name but different parameter types or a different number of parameters to be defined. It enables a single function or method name to have different implementations based on the types or number of arguments passed to it.

In ad-hoc polymorphism, the appropriate function or method implementation is determined based on the types or number of arguments at the time of function or method invocation. The compiler or runtime system selects the most suitable version of the function or method based on the provided arguments.

The basic idea behind binary space partitioning is to split a space (such as a 3D scene or a 2D polygonal region) into two halves repeatedly until a desired condition is met. This process creates a binary tree structure where each node represents a region of space, and the splitting planes or lines divide the space into two child nodes.

CPP 03

Inheritance

cpp 04

Subtype polymorphism, abstract classes, interfaces

cpp 05

Exceptions (in short TRYing to CATCH what you f*cked up)

Dealing with Bureaucrats whom can create forms, but at the end creating a lot of form is boring, so we have to create an intern whom we can pass any form and he will create it, then he need to be able to sign these forms based on the grades they have and also execute them.

cpp 06

Static casting in different ways

cpp 07

Templates

A way to write felxible and reusable code

cpp 08

An intro to templated containers, iterators, algorithms

cpp 09

Reverse Polish notation

About

42 C++ modules


Languages

Language:C++ 85.1%Language:Makefile 14.9%