/*
Inline Function
===============
If You Make The Function as Inline then execution speed of
the function becomes higher compare to normal function.
If You Like To Make a Function as Inline then you must not
include for loop,while loop,switch case and recursive
inside a function.
if you put any for or while inside a function,compiler
ignore inline and consider as a normal function.
defaultly all functions inside a class consider as a
inline function
*/
#include<iostream.h>
#include<conio.h>
class Rectangle
{
private:
int width,height;
public:
void Create(int,int);
void Display();
};
inline void Rectangle::Create(int w,int h)
{
width=w;
height=h;
}
inline void Rectangle::Display()
{
cout<<"\n Width :"<<width;
cout<<"\n Height :"<<height;
}
void main()
{
Rectangle r1,r2;
r1.Create(100,100);
r1.Display();
r2.Create(200,200);
r2.Display();
}
Inline Function
===============
If You Make The Function as Inline then execution speed of
the function becomes higher compare to normal function.
If You Like To Make a Function as Inline then you must not
include for loop,while loop,switch case and recursive
inside a function.
if you put any for or while inside a function,compiler
ignore inline and consider as a normal function.
defaultly all functions inside a class consider as a
inline function
*/
#include<iostream.h>
#include<conio.h>
class Rectangle
{
private:
int width,height;
public:
void Create(int,int);
void Display();
};
inline void Rectangle::Create(int w,int h)
{
width=w;
height=h;
}
inline void Rectangle::Display()
{
cout<<"\n Width :"<<width;
cout<<"\n Height :"<<height;
}
void main()
{
Rectangle r1,r2;
r1.Create(100,100);
r1.Display();
r2.Create(200,200);
r2.Display();
}
No comments:
Post a Comment