Results 1 to 2 of 2

Thread: Base class problem

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2015
    Posts
    17

    Question Base class problem

    I have a base class, "A", that derive the class "B":

    example.h
    Code :
    class A
    {
    private:
    protected:
    public:
    	A();
    	virtual ~A();
    	virtual void foo() = 0;
    };
     
    class B : public A
    {
    private:
           int number;
     
    protected:
    public:
    	B(int number);
    	~B();
    	void foo();
    };

    example.cpp
    Code :
    B::B(int number) : number(number) {}
     
    B::~B() {}
     
    void A::foo()
    {
    	// How can I get the variable "number" from here???
    }

  2. #2
    Newbie OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789
    This has absolutely nothing to do with OpenGL.

Similar Threads

  1. GL 3.2 and pre GL 3.2 code base
    By Mars_999 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-26-2010, 06:02 AM
  2. Camera class problem
    By openujs in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 09-22-2006, 06:38 AM
  3. C++ Class problem
    By jaymystro in forum OpenGL: Advanced Coding
    Replies: 8
    Last Post: 02-27-2006, 02:15 AM
  4. problem with OpenGL-Window Class
    By Sebastian K in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 09-21-2003, 10:18 AM
  5. problem w/ OpenGL and class based displaying
    By teflon_dragon in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 03-28-2002, 07:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean