Showing posts with label Coading Of Pure Virtual Function. Show all posts
Showing posts with label Coading Of Pure Virtual Function. Show all posts

Saturday, 27 October 2012

Program Of Write Arguments From Memory In C


#include  <stdio.h>
#include <conio.h>
 
 int  argc;                   
 
   char *argv[];               
 
   {
   
    FILE   *fp;
      
 int  i;
     
  char word[15];

       
fp = fopen(argv[1], "w");
    
   printf("\nNo. of arguments in Command line = %d\n\n",argc);
    
   for(i = 2; i < argc; i++)
    
    fclose(fp);

    Writing Content Of The File To Screen 


       printf("Contents of %s file\n\n", argv[1]);
     
  fp = fopen(argv[1], "r");
       
for(i = 2; i < argc; i++)
 
       {
   
 printf("%s ", word);
       }

      
 fclose(fp);
      
 printf("\n\n");

     Writing the Arguments From Memory

       for(i = 0; i < argc; i++)
     
  getch();
   }

Friday, 19 October 2012

Program Of Pure Virtual Function In C++

#include< iostream.h>
#include< conio.h>
{
protected :
int a,b;
public:
{ 
cout<< "\nEnter two 'int' values::";
cin>>a>>b;
} 

}; 
class xyz:public abc
{
public:
void display()
{
cout<< "\nSum for 1st derived class="<< a+b;
}
};
class mn:public abc
{
public:
void display()
{
cout<< "\nSum for 2nd derived class:"<< a+b;
}
};
void main()
{
clrscr();
xyz ob;
mn ob1;
abc *ptr;
ptr=&ob;
cout<< "\nFor object of 1st derived class."<< endl;
ptr->display();
cout<< "\nFor object of 2nd derived class."<< endl;
ptr=&ob1;
ptr->take();
getch();
}

--------------------------------------------------------------------------------------------------

Pure  Virtual Function

In object-oriented programming, a  virtual method is a function or method whose behaviour can be overridden within an inheriting class by a function with the same signature. This concept is a very important part of the polymorphism portion of object-oriented programming (OOP).


by:---http://en.wikipedia.org/wiki/Virtual_function