an object from a class, the class has to be instantiated.Instantiating a ClassObject instance methods can only be used when an object is instantiated from a
specific class. To instantiate a class, is to create a new instance of it. You can
have multiple instances of a class, meaning, you can have the same code running
multiple times. Think of how in Microsoft Word, you can have two documents
open at the same time. They are both running the same program, but are two
separate instances of that program.
When you create a new object, call the new() method to execute the code when
the object is instantiated.
Once the class is instantiated, to execute a specific method from your code, use
the reference variable followed by a "dot" operator then the method name.
myClass myClass;
]The objective of following lab is to instantiate a class, and then execute a method
myClass = new myClass();
myClass.myMethod();
from that class.
Best Regards,
Hossein Karimi
*This post is locked for comments