C# Help please

public class ClassA{

	public int intA;
	
	void Start () {
		
		ClassB iClassB = new ClassB();
	
		ClassA iClassA = new ClassA();
		
		iClassA.intA = 9;
		
		iClassB.getVal(iClassA);
		
		}
}

public class ClassB{
		
	public void getVal(object tObject){
		
		Debug.Log(tObject.intA);  // ERROR!!!
		
	}
}

This causes an “Object does not contain a definition for ‘intA’” error.

Is there a better way to accomplish what I’m trying to do here or am I missing something simple?

If you know that the method getVal() will get an object of ClassA as a parameter, then you can either change the type of the parameter (ClassA instead of tObject) or typecast the object when using it. In this case the first option seems to be more logical.
Now, if you do not know whether you will get this type, then you shouldn’t be able to access such parameter anyway.

Domino, that works perfectly, thank you!