private constructor , without object with static function

studypoint
By -
0

#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();

}


Tags:

Post a Comment

0 Comments

Please Select Embedded Mode To show the Comment System.*

3/related/default