Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Importance of static object in a class and how they are different from

$
0
0
#include "B.h"
    class A
    {
    public :
    A()
    {
    s_b = new B();
    b = new B();
    }
    static B s_b ;
    B b ;
    };
    #include<iostream>
    using namespace std ;
    #include "A.h"
    int main()
    {
    cout<<"hello";
    }

In my project i have seen static object as above . But not able to know what is the exact use of it and how they are different from general object . Please help me in finding out What all the things i can do with s_b which is not being done by b .

Thanks in advance . :)

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>