Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Tuesday, March 27, 2012

Borland C++ 5.5 - Compilation warning - Call to function with no prototype in function


I have created following simple C program and compiled with Borland C++ compiler.


#include <stdio.h>
void Printme(){
printf("Hello World\n");
}
void main()
{
Printme();
}

Compiler compiled but returns warning

"Call to function 'Printme' with no prototype in function main"


When i search in internet, I coudnt get any useful information.

After long struggle, i found that the source code should be


#include <stdio.h>
void Printme(void){
printf("Hello World\n");
}
void main()
{
Printme();
}


I hope this blog could help some of the C programmers.  

Wednesday, February 2, 2011

Execution of base class constructors


Execution of base class constructors
Method of inheritance
Order of execution
Class B: public A
{
};
A( ) : base class constructor
B( ) : derived class constructor
Class A: Public B, Public C
{
};
B( ) : base class constructor
C( ) : base class constructor
A( ) : derived class constructor
Class A: Public B, virtual Public C
{
};
C( ) : base class constructor
B( ) : base class constructor
A( ) : derived class constructor

Tuesday, January 25, 2011

C++: Default member function

In C++ programming, when we create a new [empty] class without any member function. The complier creates following member function by default. They are

1) Default constructor
2) Assignment constructor
3) Copy constructor
4) Default destructor