C
cpluszaap
This program fails i.e it is basically an example of overloading and
inheritence . The same program with minor modification is able to run
in java . please update me on the same.
#include <iostream.h>
class Base {
public:
void func() {
cout << "Base :: func(float) " << endl;
}
};
class D : public Base {
public:
int func(int f) {
cout << "D :: func(int) " << endl;
return 0;
}
};
void main() {
D *pobj = new D();
pobj->func( );
}
The Error is
ompiling...
typ.cpp
typ.cpp(29) : error C2660: 'func' : function does not take 0
parameters
Error executing cl.exe.
typ.obj - 1 error(s), 0 warning(s)
inheritence . The same program with minor modification is able to run
in java . please update me on the same.
#include <iostream.h>
class Base {
public:
void func() {
cout << "Base :: func(float) " << endl;
}
};
class D : public Base {
public:
int func(int f) {
cout << "D :: func(int) " << endl;
return 0;
}
};
void main() {
D *pobj = new D();
pobj->func( );
}
The Error is
ompiling...
typ.cpp
typ.cpp(29) : error C2660: 'func' : function does not take 0
parameters
Error executing cl.exe.
typ.obj - 1 error(s), 0 warning(s)