Posts

MutiLevel

  #include<iostream> using namespace std ; //A->B->C->Main class A{ public : int Anumber = 123 ; } ; class B: public A { public : int Bnumber = 456 ; void displayB(){ cout<< "Class A=" <<Anumber<<endl ; } } ; class C:B { public : int Cnumber = 789 ; void displayC(){ displayB() ; cout<< "Class A=" <<Anumber<<endl ; cout<< "Class B=" << Bnumber <<endl ; cout<< "Class C=" << Cnumber <<endl ; } } ; int main(){ C obj ; obj.displayC() ; return 0 ; }

Copy Constructor

  #include<iostream> #include< string .h> using namespace std ; // class Car{ int number ; char name [ 10 ] ; char fule [ 10 ] ; char color [ 10 ] ; public : Car( char * n , char * f , char * c , int num ){ strcpy (name , n) ; strcpy (fule , f) ; strcpy (color , c) ; number =num ; } Car(char* n , int num , Car &obj){ strcpy( name , n ) ; strcpy(fule , obj. fule ) ; strcpy( color , obj. color ) ; number =num ; } //=======Default== Car(Car &obj){ strcpy( name , obj. name ) ; strcpy(fule , obj. fule ) ; strcpy( color , obj. color ) ; number =obj. number ; } Car (){ } void displayValue(){ cout<< " \n Number=" << number <<endl ; cout<< " \n Color=" << color <<endl ; cout<< " \n Fule=" <<fule<<endl ; cout<< " \n Name=" << name <<endl ; } } ; int main (){ //===========...

Constructor Overloading

#include <iostream> using namespace std; class Car{ int number; public: Car(){ cout<<"\nConstructor Car()"< <endl ; } Car(int n){ cout<<"\nConstructor Car(int n)"< <endl ; number=n; } Car(int a,int b){ cout<<"\nConstructor Car(int a,int b)"< <endl ; cout<<"Sum="<<(a+b); } void displayValue(){ cout<<"Number="< <number ; } }; int main(){ Car a,b,c(12); a.displayValue(); b.displayValue(); c.displayValue(); return 0;     }  

Class Main Part 2

  #include<iostream> #include< string .h> #include "sabir.h" ; using namespace std ; int main(){ char color[ 10 ] ; char name[ 10 ] ; char fuletype[ 10 ] ; int number ; Car carObj ; cout<< "Input Color: \n " ; cin>>color ; cout<< "Input Name: \n " ; cin>> name ; cout<< "Input Fuletype: \n " ; cin>>fuletype ; cout<< "Input Number: \n " ; cin>>number ; carObj.SetValue(color , name , fuletype , number) ; carObj.DisplayValue() ; return 0 ; }

Class Car Part1 (sabir.h)

  #include<iostream> #include<string.h> using namespace std ; class Car{ //Data Member char color[ 10 ] ; char name[ 10 ] ; char fuletype[ 10 ] ; int number ; //Member Func public : void SetValue(char* c , char* n , char* f , int num){ strcpy(color , c) ; strcpy (name , n) ; strcpy (fuletype , f) ; number=num ; } void DisplayValue(){ cout<< "Color=" <<color<<endl ; cout<< "Name=" <<name<<endl ; cout<< "FuleType=" <<fuletype<<endl ; cout<< "Number=" <<number<<endl ; } } ;

diisplay

  <!DOCTYPE html > <html lang ="en" > <head> <meta charset ="UTF-8" > <title> Title </title> <style> . box { height : 200 px ; width : 200 px ; background : #80c79c ; } . gallery { display : flex ; gap : 9 px ; } </style> </head> <body> <div class ="gallery" > <div class ="box" > Box 1 </div> <div class ="box" > Box 2 </div> <div class ="box" > Box 3 </div> <div class ="box" > Box 4 </div> </div> </body> </html>

Visiblity display

  <!DOCTYPE html > <html lang ="en" > <head> <meta charset ="UTF-8" > <title> Title </title> <style> div { visibility : hidden ; } </style> </head> <body> <p> A property called visibility allows you to hide an element from view. You can use this property along with JavaScript to create very complex menu and very complex webpage layouts. <div> <h1> Computer </h1> </div> You may choose to use the visibility property to hide error messages that are only displayed if the user ne </p> </body> </html>