Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

can derived class access base class non-static members without object of the base class

class base
{
public:
    int data;
    void f1()
    {
    
    }
};
class derived : base 
{
public :
     void f()
    {
        base::data = 44; // is this possible
        cout << base::data << endl;
    }
};
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #derived #class #access #base #class #members #object #base #class
ADD COMMENT
Topic
Name
4+4 =