Jump to content
nikhil jain

how can i call a member function of class(sc_module) after finding a object using sc_find _object?

Recommended Posts

let's assume there are two classes , A and B and in sc_main i am creating the object of A "only" and in class B i am using sc_find_object(hierarchical name of A) then the result from sc_find_object  is sc_object type but class A is sc_module so, i typecast-ed into sc_module but still i am not able to call the Api's of class A inside class B.

below code is just psedo code . sorry if there is any mistake . it is just for explaining the scenario. 



A obj=new A("objectA");


class A: sc_core:: sc_module



void fun()


cout<<"Hello world";



class B



void function()


sc_core::sc_object* obj = sc_core::sc_find_object("objectA");

sc_core::sc_module* ObjNew

ObjNew = dynamic_cast<sc_core::sc_module*> (obj);

ObjNew->fun() - i.e fun exist in class B . but it is showing error 



please help 

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now