Breaking News

private constructor , without object with static function


#include<iostream.h>
#include<conio.h>

class s
{
    int b;
s(int a):b(a)
    {
    cout<<"value:\t"<<a+12;
    }

public:

    static s sp(int n)
    {
return s(n);
}
};

void main()
{
    clrscr();

    s::sp(10);

    getch();

}


No comments