Aargh! I am really confused about inheritance. I have experience with Standard C, and another OOP language (Object Pascal), but am just starting with C++.

Heres the question: is there any way for private fields/member functions to be inherited by derived classes?

So I'd do something like this (this is a bit of a silly example):

Code:
//Program 1
#include <stdio.h>

class Base {
private:
Happy() { printf("Happy "); }
};

class Derived: public Base {
public:
HappyBirthday() { Happy(); printf("Birthday\n"); }
HappyChristmas() { Happy(); printf("Christmas\n"); }
};

int main ()
{
Derived d;
d.HappyBirthday();
d.HappyChristmas();
getchar();
return 0;
}
and the compiler spits back an error, something along the lines of "Happy() is private in this context". I am using Dev-C++.

Now, I think I get why this is happening: derived classes do not have access to private members, only the public interface provided by the base class. Here's my problem: I want to make 6 classes which are virtually identical. The only difference between them, in fact, is they have different constructors. The constructor needs to be able to set up the private class members, but it turns out it doesn't have access to them. Furthermore, I need to be able to have a pointer which can point to any of the 6 classes, and so I can't just make a macro which defines the class and repeat it 6 times. I need to use derivation in some sense.

Now, I tried defining the members in the derived class, and the program compiled, but it appears that these members are different from the ones in the base class, even if they have the same names. For example:

Code:
//Program 2
#include <stdio.h>

class Base {
private:
int a;
public:
void ChangeBasea(int k) { a = k; }
void PrintBasea() { printf("%d", a); }
};

class Derived: public Base {
private:
int a;
public:
void ChangeDeriveda(int k) {a = k; }
void PrintDeriveda() { printf("%d", a); }
};

int main()
{
Derived d;
d.ChangeBasea(0);
d.ChangeDeriveda(1);
d.PrintBasea();
d.PrintDeriveda();
getchar();
return 0;
}
compiles, but prints 01 instead of 11 which is what it would print if the base and derived class members were the same.

Now, I understood scope in the context of functions in Standard C, but in Object Pascal if you did something similar then they would be the same.

Please help me understand and implement my problem above!!