Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Object array

$
0
0
using namespace std;
class book
{
private:
	char *author[3];
public:
	book(char *a)
	{
		for(int i=0;i<=2;i++)
			{
			    strcpy(author[i],a);
	                    cout<<*(author+i)<<endl;
		        }
	}
};
int main()
{	
	book b[3]={book("Hi 2 all"),book("Have fun"),book("Bad boy")};
	getch();
	return 0;
}



Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>