You are not using class within class. See what is a class.
You’re creating a class that has a field and in building it is initiating this field with an instance of another class, that’s all. Only methods are called, classes cannot be called. Understand the correct concept to continue.
Perfectly normal and common to do this.
As mechanism demonstration is all ok, the example is good because it does not expose other details not needed to this problem. But understand that a real class cannot be like that. People want to object-oriented programming without understanding what this means and need to think about a huge amount of things, and almost always do it wrong, starting by using a paradigm to manage complexity in a language of script. So that’s the least of the problems that can go wrong there. The most serious mistakes you will make is not in instantiation, it is in the general formulation of the class.
OK, thanks for the reply!! in fact I believe I have formulated the question badly...I want to use methods of other classes within a new class...even so, I’ll take a look at the link yes!! thanks again!!!
– horacio2019
I can only answer what you asked.
– Maniero