|
-
May 10th, 2006, 04:56 AM
#1
why can not we assign base class object reference to derived class pointer?
class Base
{
public:
Base(int ii = 0 , char cc = 65) : i(ii) , c(cc) {}
int i;
char c;
};
class Derived
{
public:
Derived(int ii = 0 , char cc = 65 , int id = 10 , char cd = 66) : Base(ii , cc) , i(id) , c(cd) {}
int i;
char c;
};
void main()
{
Base bo;
Derived *dp = &bo;
}
Last edited by adapanaidu; May 10th, 2006 at 05:02 AM.
Reason: question is wrong.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|