Goldman Sachs Interview Report
- 0of 0 votes
Answersclass a{ public: int a; virtual void sum() { printf("sum"); } }; class b : public a { public: int b; virtual void sum() { printf("sum of class b"); } }; void main() { b aptr; a *bptr; bptr = &aptr; bptr->sum(); }
Output of the above program?
- sohit April 09, 2013 in United States| Report Duplicate | Flag | PURGE
Goldman Sachs Applications Developer C++ - 0of 2 votes
Answersclass a{
- sohit April 09, 2013 in United States
public:
int var1;
a(int var)
{
var1 = var;
}
};
class b: public a
{
public:
int var2;
b(int d) : var2( d++) , a(var2++)
{
}
};
int main
{
b obj1(5);
}
What will be the value of the variable 'var1' in class A?
a) 6
b)7
c) 5
d) undefined| Report Duplicate | Flag | PURGE
Goldman Sachs Applications Developer C++
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.