Skip to content
/ cpp Public

This is the record of my cpp_piscine project at 42

Notifications You must be signed in to change notification settings

Guiribei/cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPP

Summary

The CPP Piscine brings an intensive exploration into the realm of C++ programming. This repository highlights the foundational concepts of OOP, notably Abstraction, Encapsulation, Inheritance, and Polymorphism. The content goes beyond the basics, diving into advanced C++ functionalities such as operator overloading, static class management, and the nuances of the Standard Template Library (STL) containers. Furthermore, the inclusion of templates in the C++98 standard demonstrates the application of type-safe and adaptable coding practices. This repository serves as a comprehensive showcase of C++ mastery for enthusiasts and professionals alike.

Features

  • cpp_00: Namespaces, classes, member functions, stdio streams, initialization lists, static, const, and some other basic stuf
  • cpp_01: Memory allocation, pointers to members, references, switch statement
  • cpp_02: Ad-hoc polymorphism, operator overloading and Orthodox Canonical class form
  • cpp_03: Inheritance
  • cpp_04: Subtype polymorphism, abstract classes, interfaces
  • cpp_05: Repetition and Exceptions
  • cpp_06: C++ casts
  • cpp_07: C++ templates
  • cpp_08: Templated containers, iterators, algorithms
  • cpp_09: STL

Tips:

- Encapsulation: Group related data and functions together within a class, and hide the implementation details from outside the class using access specifiers (private, protected, public). This makes the code more modular and maintainable.

- Constructors and Destructors: Provide constructors for initializing objects and destructors for cleaning up resources when objects are destroyed. Consider using constructor initializer lists, and properly handle object copying through copy constructors and assignment operators.

- Inheritance: Use inheritance to model an "is-a" relationship between classes, and promote code reusability. However, avoid deep inheritance hierarchies, as they can lead to increased complexity and maintainability issues.

- Polymorphism: Utilize virtual functions to allow derived classes to override base class functionality, enabling dynamic dispatch at runtime. This allows a more flexible and extensible design.**

- Prefer composition over inheritance: Favor assembling complex objects from simpler components (composition) over using inheritance to extend functionality. Composition leads to more modular, maintainable, and flexible designs.

- Use const and static: Use the const keyword for member functions that do not modify object state, and use static for class-level data and functions that do not depend on any specific object instance.

- Follow coding standards and style guides: Adopt a consistent naming convention (classes in CamelCase), indentation style, and commenting practice to make your code more readable and maintainable.