Aricent Interview Question for Technical Architects


Country: India
Interview Type: In-Person




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

Define a class with only protected constructors. This way the only thing that can construct the object is a child class.

- maktech07 November 27, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

That doesn't quite qualify as a non-instantiable (abstract) class, though. It's possible that this is what the interviewer wanted, but it's worth noting that child classes will be able to construct instances of the base class in contexts other than the child class constructors. For example, it would be possible to make a child class have a method that does something like "return new Base()", without any sort of enforcement of the idea that Base should never be instantiated directly.

I don't really have a better approach, in any case.

- eugene.yarovoi November 28, 2012 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

define your destructor as pure virtual

- xiayingp November 29, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

So then the destructor is a virtual function and we've still used a virtual function.

- eugene.yarovoi November 29, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

what about inherited a abstract class? Then the derived class will be a abstract class.

- xiayingp November 29, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

inherit the class from an abstract class and don't override the pure virtual function of the base class, this makes the derived class also abstract class .

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

class MakeAbs
{
public:
virtual void dummy()=0;
};
class MyClass:public MakeAbs
{};

- Chandrakant November 27, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

bt this is also a type of virtual function no???
called pure virtual function.

- asm November 27, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

As per m knowledge abstract class is the one, which have pure virtual function.

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

To define a function as abstract in C++ ( with the = 0; ) the function must be declared virtual as well to provide the ability to override the function in the child class. I can't find the line in the spec but, try it in VS and you will:
error C2253: 'Abstract::AbstractFunc' : pure specifier or abstract override specifier only allowed on virtual function

An abstract class has two features, cannot be created without being sub-classed and forces the child class to override a function.

My original suggestion above provided the first. Since the question does not want us to use virtual, then the second feature is not possible.

- maktech07 November 27, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

use key word "abstract".
abstract class CA
{
};

- Ian F. April 11, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Virtual member functions are inherited. A class derived from an abstract base class will also be abstract unless you override each pure virtual function in the derived class.

for example: -

class base
{
	public:
	virtual void makevirtual()=0;
};

class derived:public base
{
};

here, derived has no virtual function and is still an abstract class

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

Make all the constructors(including compiler provided constructor i.e copy ctor) private and also provide protected static method through which can instantiate an objects

- Mahadev April 27, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

fd

- Anonymous November 27, 2012 | 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