On Aug 21, 4:57 pm, Ami <ver_amit...@yahoo.com> wrote:
> On Aug 21, 4:16 pm, Obnoxious User <O...@127.0.0.1> wrote:
>
>
>
> > On Tue, 21 Aug 2007 04:14:31 -0700, Ami wrote:
> > > Hi All,
> > > I am trying to create a class whose constructor takes Void
> > > parameter and stores it for future reference. It works fine as
> > > expected.
>
> > > class base
> > > {
> > > public:
> > > base(LPVOID pObj){ //store lpvoid for reference};
> > > virtual ~base(){};
> > > virtual void func1() { printf("Hello from base\n") };
> > > };
>
> > > When I create another class from above given class and try to create
> > > object from it, it get following error.
>
> > > error C2664: 'derived::derived' : cannot convert parameter 1 from
> > > 'const int' to 'const class derived &'
> > > Reason: cannot convert from 'const int' to 'const class
> > > derived'
> > > No constructor could take the source type, or constructor
> > > overload resolution was ambiguous
>
> > > class derived:public base
> > > {
> > > protected:
> > > virtual void func1(){ printf("Hello from Derived\n") };
>
> > public:
> > derived(LPVOID v) : base(v) {}
>
> > > };
>
> > > int main()
> > > {
> > > base *nderived= new derived(NULL); //error
> > > }
>
> > > Please can any one help me to make this working.
> > > Thanks and Regards
>
> > --
> > Obnoxious User
>
> Hi Obnoxious,
> Many thanks for reply. It works as expected. Thanks again.
> Regards
Many thanks all of you for suggestion.
Regards,