Wednesday, October 24, 2018

How inheritance is related with constructor


Saturday, October 13, 2018

Friend Function and Friend class in C++

Friend Function:-

A friend function of a class will be the friend of that class. It will not be the member of that class but it has authority to access all the member of that class even they are private or protected. A friend function can be written in any scope of the class like private, protected and public. 

A friend function declaration will be in the class preceded by friend keyword and its declaration will be outside. 

A friend function is not a member function  (not a part of the object) of the class that means it will not be called by the object name. It is called directly by writing the name of the function with brackets. 

Syntax of friend function declaration:- 

friend return-type function-name(class object);

Syntax of friend function definition:-

return-type function name(class object) 

{

           Statements;

}

#include <iostream>
#include<conio.h>
using namespace std;
class pramod
{
private:
    int a,b;
public:
    friend void add1(pramod s);
    void add2()
    {
        cout<<"Hello"<<endl;
    }
    pramod()
    {
        a=10;
        b=20;
    }
};
void add1(pramod s1)
{
    cout<<s1.a<<endl<<s1.b<<endl;
}
int main()
{
    pramod ob1;
    ob1.add2();
    add1(ob1);
}



Friend Class :-

If we want to make class as a friend function then it well be done by writing the class name preceded by keyword friend. 

Like friend function it can also access all the member function as well as data member of that class where it is defined. It can access all of type of data and member function define in any scope like public, protected and private.



 

  

Nested Class in C++

Nested Class:-

If a class declared inside another class is known as nesting of classes. The outer class is known as enclosing class and the inner class is known as nested class.

A nested class is a member of outer or enclosing class so all the so it will have same access right as other member function contains. 

Inner class object must be preceded the outer class name with scope resolution operator(: :). 

                     
    
#include <iostream>

#include<conio.h>

using namespace std;

class Outer

{

    int a;

public:

    int c;

//private:

    class inner

    {

         int d;

     public:

        int e;

        void show1()

        {

            cout<<"private variable is called in public member function="<<d*d<<endl;

        }

        inner()

        {

            d=10;    // Initialize the inner class variable at the time of object call.

            e=20;

        }

    };

    inner ob1;      //private scope object of inner class.

     public:

        inner ob2;  // public scope object of inner class.

    void show2()

    {

        ob1.show1(); //ob1 Behaves as a private variable of outer class.

        show();

    }

    Outer()

    {

        a=30;

        c=40;

    }

     private:

        void show()

        {

            ob2.show1();

        }


};

int main()

{

    Outer ob;

    //inner in;            // we can not make object of inner class directly.

    Outer::inner oi;     // we can not make object of private inner class. inner class must be public.

    oi.show1();

    ob.show2();

    return 0;

}





Friday, October 12, 2018

Attributes of HTML tags

Attributes in HTML:-

Attributes is an additional information of a HTML tags or HTML elements. By the tags of HTML we can only write text but by the attributes we can do formatting on HTML contents.We can change color, style and different type of formatting to a HTML contents.  

* Attribute always comes in name and value pair.
* It always written with starting tag.
* It provides additional information to a HTML tag that means each and every tags may contains there own different attributes.

Attributes of BODY tag:-

Body tags also contains different-different attributes which have different meanings. Following are some examples of BODY tag.

Background Attribute:-

Background attribute is of body tag which is used to set the background image. It the inserted image is smaller in size, it automatically gets replicated down and across to fill the entire web page. Example of background attribute of body tag

Syntax: <body background="path of your image\image name.extension of the image">

<html>

<head>

<title>Title of the web page is written here</title>

</head>

<body background="c:\image\pic.jpg">

</body>


       BGCOLOR Attribute of BODY tag:-

This attribute of body tag is used to set the background color of the web page. The value of this attribute can be specified in the form of color name or in the form hexadecimal form. 

Syntax:-      <body bgcolor="blue"> 

Text Attribute of BODY tag:-

This attribute of body tag is used to set the color of the body text. Value of this attribute can be in the form color name or in the form of hexadecimal form.

Syntax:- <body text="red">

Link Attribute of BODY tag:-

 This attribute of body tag is used to set the color unvisited hyperlink. By default the color of the hyperlink is blue. we can change it  to our choice. we can use link value as color name or hexadecimal form.

Syntax:-  <body link="red">

Vlink Attribute of BODY tag:-

Vlink stands for visited link. This attribute of body tag is used to change the color of visited hyperlink from default. By default the color of vlink attribute is purple. we can use the value of vlink attribute in form color name or in the hexadecimal form.

When you close the the website/wepage that has been opened using hyperlink and go to page  from where you opened it, you will found that its color has been changed to purple. This is happened due to the property of Vlink.

Syntax:- <body vlink="green">

Alink Attribute of BODY tag:-

Alink is stands for active link. This attribute is used to change the color of active link from default. By default the color of active link is red. We can use the value of alink attribute in the form color name or in the form of hexadecimal form.

When we click on a link and when the website/webpage is open in another tab if you go and see the link which you clicked, it will be red in color. This means the you opened webpage/website which are in the active mode.

 <html>
<head>
<title>Title of the web page is written here</title>
</head>
<body bgcolor="yellow" link="red" alink="black" vlink="#000000">
<a href="http://www.facebook.com">Facebook</a>
</body>
</html>

TOPMARGIN attribute of HTML tag:-

This attribute of BODY tag is used the set margin of the text from top of the web page. 

Syntax:-  <body topmargin="5px">

LEFTMARGIN attribute of HTML tag:-

This attribute of BODY tag is used the set margin of the text from left of the web page. 

Syntax:-  <body leftmargin="5px">

RIGHTMARGIN attribute of HTML tag:-

This attribute of BODY tag is used the set margin of the text from right of the web page. 

Syntax:-  <body rightmargin="5px">




                                                                                                                                                                                                                                                                                                                                         




Thursday, October 11, 2018

Structure of HTML

Structure of HTML:-

HEAD TAG:- 

In this section title is written in title open and close tag. In this section we also write java script code and code for connecting CSS(Cascading Style Sheet).

BODY TAG:-

In this section we write the the content of the HTML page.   

HTML ELEMENT:-

All HTML tag are the predefined keyword written within the angle brackets ('<' and '>') . Each tag has a specific meaning. So for writing the HTML code we must remember these predefined tags.
             An HTML element is a tag pair enclosed with displayable contents.
<p> This  is SRPS. It is very nice.</p> is the example of HTML elements. There are two types of HTML elements.

Container element:-

Container element or container tag are those elements who has opening and closing tag and can contain other  HTML elements.

Empty element:-

Empty element or empty tag are those elements who doesn't have closing tag. It is having only opening tag. example <img>, <br>,<hr> etc.

Below is the example of container and empty elements.

                                                  <html>
                                                 <head>
                                        <title>SRPS</title>
                                                </head>
                                               <body>
<p>This is SRPS. It is located at purana dhakhana basti uttarpradesh </p>   <!-- container elements  -->

                                          <hr width="80%" size="10px">     <!-- empty elements  -->

                                           <p>end of the this  content.</p>     <!-- container elements  -->
                                                </body>
                                              </html>

  


Structure of HTML TAG


Special characters in HTML:-

There are some special characters in HTML which we can't use directly in HTML documents like >,<, &, ", blank space etc.
Characters                                       symbol
>                                                       &gt;
<                                                       &lt;
&                                                      &amp;
"                                                       &quot;
Blank Space                                    &nbsp;

             etc.
 
                  

Tuesday, October 9, 2018

static keyword in C++

Static keyword description:-

A static keyword can be applied with member variable as well as member function of the class. If we define a variable is static then that variable will be global that means variable will be the part of class not of the object. Memory allocation for the static variable will be done by only once. Static variable will be shareable to each and every object and its memory will be allocated only once at the time of class creation. 

The variable and the function which are the part of the object is called instance variable. Static variable is called class variable. If we do not provide the initial value to the  object variable then it will take garbage value and static variable  will take default values. 

How to make a variable static:-

We can make a variable as a static by simply write keyword static before variable name. There are necessary condition to define that variable outside the class.

Data type of variable  Class-name:: variable-name;

we can also initialize by our own value to here by code

Data type of variable Class-name:: variable-name value;

#include <iostream>
#include<conio.h>
using namespace std;
class pramod
{
    public:
        int a;          //if don't initialize instance variable then it will
        static int b;                //take garbage value(Any value defined by compiler)
        void add(void);
};
int pramod::b;
void pramod::add()
{
    cout<<a<<endl;
    cout<<pramod::b;
}
int main()
{
    pramod ab;
    ab.add();
    return 0;
}

  Static Function:-

If we write static keyword before member function then that function will be the static function.

Necessary Condition for function:-

1. If a variable is static then it may or may not written in static function.

2. If a function is static then it must contain only static variable.

3. A static variable or a static function will be called by class name but it can be called by object name also.

#include <iostream>
#include<conio.h>
using namespace std;
class pramod
{
    public:
        int a;
        static int b;
        void add(void);
        static void add1()
        {
            //cout<<a;   //we can not write non static variable in static
            cout<<b<<endl;
        }
};
int pramod::b;
void pramod::add()
{
    b++;         //retain its previous values.
    cout<<b<<endl;//static variable is written in non static function.
}
int main()
{
    pramod ab;
    ab.add();
    ab.add();
    pramod::add1();
    cout<<ab.b;  //call static variable by object name no problem
    return 0;
}



 

Characteristic of HTML and Introduction of Client Server Architecture

Characteristics of HTML:-


1. It is easy to understand because it does not require any programming language to write the code.


2. It is platform independent that means it can be displayed on any platform like Windows, Linux, and BOSS etc.


3. It can run on any web browser (like Mozilla, Firefox, Opera, and Internet Explorer etc) that means it is not dependent on web browsers.


4. It provides flexibility to add audio, video, animation, 3D-picture for making our page more attractive.


5. It is not case sensitive that means if we write HTML and html it means same.


6. It is having some predefined tags by the help of that tags we make our web pages.









7. By the html we create only static web page (i.e. structure of web page) but by the programming language we create dynamic web page. 





 Use of HTML:-


Before starting to write code of mark up language we should know what is the need of HTML.Web browser (Client) is software which is responsible to run the content of WWW (World Wide Web). These content are pictures, audios, videos and web pages.

Web server is also computers which are responsible to keep our html pages. It gives response when it is asked by the web browser in the from HTML page. So it is the responsibility of Web browser to render the code of the HTML and show to the user. It is clear that Web browser play a very important role.

Image result for client server architecture


Monday, October 8, 2018

Html Description

About Html:-

Html stands for hyper text markup language. It is not a programming language. It is used to design static web pages. A web server is a collection of web pages and these web pages are html pages. These web pages are connected with each other with the hyperlinks. 

                                                   Image result for html

History of Html:-

Tim Berners-Lee is the innovator of the Web. In 1989, Tim was working in a processing administrations segment of CERN when he concocted the idea; at the time he had no clue that it would be actualized on such a gigantic scale.

Html is a subset of SGML(Standard Generalized Markup Language). It contains a lot of predefined tags which are used to form the layout of the html. SGML was developed by International Organisation For Standards in 1986.

                                                   Image result for Tim Berners-Lee html

Versions of Html:-

Html 1.0 is a hybrid  of SGML, it was having only 20 elements and right now 13 elements is the part of version 4.01. After Html 1.0 different version came in the market like html 2.0, html 3.0, html 4.0 and the latest version is html 5.0.

Html 4.01 was the latest version of the html but it was replaced by the XHTML(extended  hyper text markup language). Html was completely substituted not only Html 4.01 but also XHTML.   

VersionYear
HTML1991
HTML 2.01995
HTML 3.21997
HTML 4.011999
XHTML2000
HTML52014

Where you can write the code of HTML:-

My suggestion is to the beginner write your code on notepad or notepad++ and save it to with dot(.)html or dot(.) htm. 

There are a lot of IDE(Integrated Development Environment) where you can write your html code. These IDE will give some hints about the html elements and many different problems so it will not be good for starter.  

Image result for browser  Image result for server

After typing the html code in to the notepad it will be saved as .html(or .htm) extension. Any existing browsers are responsible to run our html code. 

Font and Basefont tag of html in a very easy way.

Difference between font and basefont tag in html:- Font tag is a container tag. Basefont tag is empty tag. We can apply font tag in a ...