Interview Question for Solutions Architects


Country: United States




Comment hidden because of low score. Click to expand.
0
of 0 vote

Insufficient details in the question.

What is the type that function is supposed to return? void *?

How would the caller know what to cast it to, in order to actually use it?

Do you want people to design a COM (Microsoft's solution for this type of a problem) like system?

- Anonymous March 27, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

We need to use class loader to instantiate the class. Class.forName internally uses class loader. Not sure if this helps...

- rizwan.amd March 27, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

do u mean java reflection?

- zyfo2 March 29, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

It is tagged as C++.

- Anonymous March 29, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

so you want to create a object of class based on class name.I am ZERO in java.please provides more details.
e.g

class_name* createObj(const string &class_name)
{
return new class_name;
}

- gr81 April 01, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

this is one way of using it

class Class {
public:
static class* forName (const string* name) {
if (strcmp(*name,"CLASS") {
return new Class;
}
else(strcmp(*name,"DERIVED"){ //in case a derived obj is to be created
return new Derived;
}
}
};

this type of obj creation is mainly needed when we create an obj during run time depending on the user input. hope this helps.

- Anonymous April 04, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think its asking us to build objects based on the reflection concept.
We need to use map having Key as class name and value as Object Creator function. Every class will register to that map and in run time objects will be getting created.

i can post the code in c++ also if required.

- Prabhat Kumar Srivastava August 26, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

This is not possible to implement it, since String is purposely immutable in java, just to avoid the manipulation of loading the classes by their name.

- Anurag August 31, 2015 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More