S
[chuckles] Where can you use a method? ] La visibility of members in C++ is public, private or protected. Then if you do a method with public visibility, you can request it from the class itself, a subclass, or through its created class instances. With private from the class itself. And protected : classes and subclasses, but not from created class instances.[chuckles] To access the methods of one class from another class ] If you want to access a method from another method, the best thing is that you put it as protected, declaring the class from where you go to call it a subclass of the class in which it is said method (or as a class derived in the class hierarchy, of the class where the method is (base class). Another option is to be in the same class (private method); or, if they belong to two different classes, because you create an instance of the class to which you want to access (public method), the point where you need it, and the instances. Just like you would from the main program, but from within the method you're going to need it. Or that, or you can also create a common class with the methods of greater use, create an instance of the class and instances the method (public).Before continuing, to make your program work, you have to be free of mistakes. The way you created the class, it's not right for many reasons. I suggest you check it out. You have not declared the methods, and you have programmed them as if they were functions. Methods are not functions. In C, functions and bookstores are used, C++ is object-oriented programming, here there are no functions or bookshops, but classes and methods.Another point is that, in order to access the methods of a class: you have to create an instance of the class. In the code you've put, you don't create the class instance. Only when you create an instance of a class, you can use their methods. The object-oriented programming is based on encapsulation. When creating an instance of the class, the builder is called, there are initialized the required values, properties, members and spaces of memory that are assigned for subsequent use when resorting to the methods: for the operation of the class instance as a coherent, integral object. Then through the object of the class (of the created instance of the class), you can use its methods. This is because the methods are part of the class.Create an instance of a class in C++void main()
{
// Crear instancia de la clase Cliente ...
Cliente cliente_1 (2000,"Jose Apellido Apellido2");
// Instanciar el metodo Deposito ...
cliente_1.Deposito(450);
....
....
....
A class is made up of methods so that they can solve a number of needs in a certain area, this is the concept of object, it has a direct relationship with the ways in which it can be applied, openly.In the same way that in order to drive a car or wash it, you must have bought or rented the car. The class would be like the full description or concept of an object, and instance the class would be like to create, request, or do the exact thing to get the object itself, which allows to do a number of things.