function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sourav PSourav P 

Casting a Data Type "Object" to a custom class type ?

Hi,
Can anybody explain in simpler term, what exactly a data type " Object" in apex and what it mean to cast an object to a custome class ?

In below example, why not we can use as below ? ,
obj. someClassMethod ();
what is the need of the below,
MyApexClass mc = (MyApexClass)obj;

User-added image

 
Nand AroraNand Arora
You can refer to this link (https://salesforce.stackexchange.com/questions/42594/object-class-in-apex) for a decent explanation.