how to get a specific class object
- by user1275129
I am still quite new to class concept. I have a problem here. for example, i have a class called
class p{
int id;
p(id){
//constructor
}
}
now, i want to make instances of class p. After i have all the instances. i want to build a function get_p(pid) to return the specific class p which id=pid, how can i write this part?
I have read c++ and java class tutorials, but i cant sort this out. please help me.