Description:

This project is a simple example C++ program that demonstrates the basic concepts of object-oriented programming, dynamic memory allocation, and object transfer between functions. The code defines the MyClass class, which manages a dynamic array of integers.


Project structure:

level (intern/jun)


The project includes the following files:

main.cpp: The main program file containing the main function and the definition of the MyClass class.

Usage

To compile and run this project, follow these steps:

1)Make sure you have a C++ compiler installed (for example, g++ for Linux or MinGW for Windows).

2)Clone the repository:

git clone https://github.com/Nikita-Dmytriienko/ForGitHub1.0.git

3)Navigate to the project directory:

cd path/to/ForGitHub1.0

4)Compile the program using the C++ compiler:

g++ main.cpp -o ForGitHub1.0

5)Run the program:

 ./ForGitHub1.0

MyClass class:

Public members:

{

  • int* data: Pointer to a dynamic array of integers that stores data.

  • Public methods:MyClass(int size): A class constructor that initializes the object and allocates memory for a data array of size size.

  • MyClass(const MyClass &other): A copy constructor that creates a copy of the other object and its data.

  • ~MyClass(): Class destructor that frees the allocated memory for the data array.

Example class usage:

MyClass a(10); // Create an object a of class MyClass with an array of size 10.
MyClass b(a); // Create object b as a copy of object a.
// An example of using the constructor and destructor of the MyClass class.

Functions Foo and Foo2
void Foo(MyClass value): A function that takes an object of class MyClass by value and displays the message "Foo(MyClass value)".

MyClass Foo2(): A function that creates a temp object of class MyClass and returns it.

Example function usage:

Foo(a); // Call the Foo function with object a as an argument.
MyClass c = Foo2(); // Call the Foo2 function and assign the result to the object c.

// An example of using the Foo and Foo2 functions.

Main function (main):

The main function is the entry point to the program. This function creates objects of the MyClass class, calls the Foo and Foo2 functions, and demonstrates the basic concepts of classes and functions.

Optimizations

  • Refactoring
  • Performance improvement
  • Accessibility

🛠 Skills

  • C++

Author

🚀 About Me

Good day! My name is Nikita Dmitrienko and I am a beginner C++ developer. My main efforts are focused on system and application programming in this language. I study in-depth the concepts of object-oriented programming, working with pointers and references, as well as other fundamental aspects of C++.

My ambition is to develop professionally in C++ development, and I pride myself on my ability to actively and systematically develop in this area. I have recently started actively posting my projects on GitHub, demonstrating my progress and willingness to collaborate in a team of talented developers.

I look forward to applying my knowledge and skills as a Junior C++ Developer and contributing to the success of a top company. Ready to listen attentively, learn and grow together with a team of professionals.

🔗 Links

linkedin telegram github

Support

For support, email: nik.dmitrienko2000@gmail.com

Related

there will be new projects here soon =)

README