Lets consider the following example..
1)
Classs Customer{
string custName;
public Customer(String name) {
this.custName = name;
}
public String getCustName(){
return this.cusName;
}
}
2)Class Abc{
Customer c1 = new Customer("John" );
MainFile mf = new MainFile();
mf.sample(c1);
3)
Class MainFile{...
User Profile
Collapse
-
Hi guys..
The reply was right.. But after i accept the object of the class in the object of type Object. The problem is after that i am not able to call the methods of the class object passed to it. The method getClass() gives me the name of the orignal class.. and the method getDeclaredMeth od also does not help..
Thank you,..Leave a comment:
-
Thanks for your reply.
But the problem is i dont know as to how many and wht are the class that i need to check with the object.(Like in this case.. its C1 and C2 are known)..
How do i generally have an object.. which can invoke the methods of the class that is passed to it.. at runtime..
Eagerly waiting for ur valuable reply.....Leave a comment:
-
Determining and invoking methods of a class
Hi,,
I am new to programming languages..
I want this problem to be resolved.
Consider a situation of three class.. C1, C2 & C3.
Class C3 has a method that receives the object as the arguement.
class C3 {
public void xxxxx(Object ob)
}
I want the arguement of the method to be capable of taking the object of any class and display/call the methods of...
No activity results to display
Show More
Leave a comment: