|
-
January 18th, 2013, 08:32 AM
#5
Re: How to create global object
You are first defining myobj as a pointer to the class Light. You are then defining myobj as a pointer to the class Fan. You now have two definitions for myobj which are different - which the language/compiler does not allow. You are trying to have myobj as either a pointer to Light or a pointer to Fan depending upon choice and then passing myobj as a parameter to switchUp. Unless Light/Fan are derived from the same base class and you are trying an example for polymorphism then I suspect your design is wrong. What is the defintion of switchUp? and what are you trying to achieve?
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
|