Faqts

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

how can we access private data member or member function of one class to another ?

Jan 31st, 2010 17:15
forum net tr, i can do it, praveen tripathi, praveen tripathi


we can simply access data member or member function from one class to 
another:
we can make friend to both classes.
suppose i have to access private member of class 'a'in class 'b'
we will define friend class 'a' inside class 'b'.
for example:-
class a
{
    friend class b;
private:
    int v1;
};
class b
{
public:
    void inita()
    {
        a some_a;
        // Here we access the private member variable v1 
        // in A as if it were public
        some_a.v1 = 10;
    }
};
derlenmis turk video sitesi http://www.videoturk.gen.tr Video secilmis
youtube videolari http://www.youtubevideolari.net/ youtube videos online
video izle tr tube http://www.videotrtube.com/
firmalar sirketler rehberi http://www.sirketfirmarehberi.com/ firma
sirket rehberi adres telefon bilgileri
full program full oyun http://www.forumnettr.com/ download