C++ programming language part: 49 Scope Resolution Operator
Scope
Resolution Operator
The member functions are defined within the class specifier.
These function can be also be defined outside the boundaries of the class the scope resulution operator
Program 39_1
class
nova //class defined
{
private:
int age; //
member data
char name[10]; //member data
public:
void data_in(); //
member function
void data_out(); //
member function
};
void nova::data_in() //scope resolution operator
{ cout<<" Type your age
"<
cin>>age;
cout<<"Type your name
"<
cin>>name; }
void nova::data_out() //scope resolution operator
{
cout<<" The age is "<
cout<<" The name is
"<
void
main()
{ nova k; //
k is called object
k.data_in(); //would
be k->data_in() if pointer
k.data_out();
}
SUBscript
Program 41_1
void main()
{
char
days[7][10]={"sun","mon","tus","wed","ths","fri","sat"};
char months[12][10]={"jan","feb","mar","apl","may","june","july","aug","sep","oct","nov","dec"};
int i,j;
cout<<"Type date of the months
"<
cin>>i;
cout<<"Type number of the month
"<
cin>>j;
int d;
d=1%7;
cout<<"The day is "<
cout<<"The month is
"<
}
Program 41_2
class bappi //class
defined
{
private:
int a,b; //
member data
public:
void date(int x,int y)
{
a=x;
b=y;
char
days[7][10]={"sun","mon","tus","wed","ths","fri","sat"};
char
months[12][10]={"jan","feb","mar","apl","may","june","july","aug","sep","oct","nov","dec"};
int i;
a=i%7;
cout<<"The day is
"<
cout<<"The month is
"<
}
};
void main()
{
clrscr();
int kk,ll;
cout<<"Type the day
"<
cin>>kk;
cout<<"Type the month
"<
cin>>ll;
bappi k;
k.date(kk,ll);
}
Part- 86 assign the content of twostring
জ্ঞানকোষ প্রকাশনী
৩৮/২-ক, বাংলাবাজার (২য় তলা), ঢাকা।
ফোনঃ ৭১১৮৪৪৩, ৮১১২৪৪১, ৮৬২৩২৫১.
কলকাতায় পরিবেশক/প্রাপ্তিস্থান
রিতা ইন্টারন্যাশনাল
৩৬, পি.এন. ব্যানার্জি রোড, কলকাতা
ফোনঃ ২৫১৩৮৩৫৯, ৯৮৩০৪৩৯৬৭৯, +৯১৯৮৩০৪৩৯৬৭৯