Amazon Interview Question
Software Engineer / DevelopersTeam: AWS
Country: United States
Interview Type: Phone Interview
My understanding is as following apart from the above answers. Please correct me if you think something is not feasible.
1. We need to think whether we want to create an abstract class (making some of its method as pure virtual). If there is a possibility of extending the behaviors of this class we can make some of its member function as virtual.
2. On the other hand, if the class has to used with different data types and there is not much change in the behavior (i.e. member functions) for data types, we can create a template class. For example while writing any container class we may think of making it a template class, so that different data types can be stored inside the container class.
This would depend upon the business use case for which we are designing/writing the class.
My understanding, actually some common senseļ¼
1. What's the class used for? You cannot include everything or too much in one class.
2. You are going to create an abstract class or a class inheriting another?
3. Namespace, Constructors, Members, Properties, Methods, etc.
4. The role of this class in your design/architecture/model.
5. ...
1.private variables.
2.public get and set methods
3.multiple constructor-without args,with 1,2,3,... args,copy constructor
4.do i need to overload operators? +,-,=. eg.in matrix class overloading + will simplify usage
5.destructor. free memory if you allocated any
6.Do I need virtual functions or an abstract class or just a simple class?
I'm from C# background I know very few about C++.
- Srigopal Chitrapu April 29, 2014In general the below points comes to my mind while start writing any new class.
If interviewer is mainly looking for C++ related features, below list might not help much.
1. OOPS Features and Concepts (Basic private/public members, properties, methods etc. Constructors, destructors for C++ classes).
2. OOPS/SOLID Principles.
3. Design Patterns.
4. IoC.