Adobe Interview Question
Developer Program EngineersCountry: India
Interview Type: In-Person
Though its a very simple one, we can also implement function overloading and inheritance in C
Kind of Simple inheritance in C
#include<stdio.h>
typedef struct A
{
int a,b;
float c;
}parent;
typedef struct B
{
parent P;
int c,d;
float f;
}child;
void cparentinitialize(child *c,int a,int b,float f)
{
c->P.a=a;
c->P.b=b;
c->P.c=f;
}
void initializec(child *c,int a,int b,float f)
{
cparentinitialize(c,a,b,f);
c->c=a;
c->d=b;
c->f=f;
}
int main()
{
child c;
initializec(&c,1,2,3.3);
return 0;
}
We can have something like this
- Luv July 03, 2012