help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing some values to the parent class


From: red floyd
Subject: Re: Passing some values to the parent class
Date: Thu, 21 Jun 2007 13:58:32 -0700
User-agent: Thunderbird 2.0.0.4 (Windows/20070604)

jalqadir@gmail.com wrote:
class Base{
   private:
      int i;
      char* c;
   public:
      Base(const int, const char*);
      ...
};
class Derive : virtual public Base{
   private:
      ...
   public:
      Derive(const int x, const char* y){ pass_vars_to_base_class

(x,y);}
   ...
};

The class above shows something I want to do, to pass some values to
the parent class. Can someone please tell me how to do this?

Thanks folks!


Initializer list.

Derive::Derive (const int x, const char* y)
    : Base(x, y)
{
}


reply via email to

[Prev in Thread] Current Thread [Next in Thread]