Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Base
- {
- public:
- Base(string S)
- {
- ...
- };
- }
- class Derived: Base
- {
- public:
- int foo;
- string bar()
- {
- return stringof(foo); // actually, something more complex
- };
- Derived(int f) : foo(f), Base(bar())
- {
- };
- }
- class Derived: Base
- {
- public:
- int foo;
- static string bar(int f)
- {
- return stringof(f); // actually, something more complex
- }
- string bar()
- {
- return bar(foo);
- };
- Derived(int f) : Base(bar(f)) , foo(f)
- {
- };
- }
- Derived(int f) : Base(stringof(f)), foo(f) {}
- class Base {
- public:
- Base(string S) { ... }
- void bat() { ... }
- };
- class Derived {
- Base *base;
- int foo;
- public:
- Derived(int f) : base(NULL), foo(f) {
- base = new Base(bar());
- }
- ~Derived() {
- delete base;
- }
- string bar() {
- return stringof(foo); // actually, something more complex
- }
- void bat() {
- base->bat();
- }
- };
- class Derived: Base
- {
- public:
- int foo;
- string bar()
- {
- return stringof(foo); // actually, something more complex
- };
- Derived(int f) : foo(f), Base(bar())
- {
- };
- }
- class Derived: Base
- {
- public:
- int foo;
- static string bar(int f)
- {
- return stringof(f); // actually, something more complex
- };
- Derived(int f) : Base(bar(f)), foo(f)
- {
- };
- }
Add Comment
Please, Sign In to add comment