2nd puc computer science chapter 8 function overloading ,types of function overloading ,syntax function overloading ,example function overloading
inline function, friend function ,
Functions allow programmers to structure C++ programs into modular segments of code to perform individual tasks. There are two types of functions: library functions and user-defined functions. User-defined functions are defined using a return type, function name, and parameters. Functions can be called by value or by reference and can also be inline, recursive, or friend functions.
Virtual functions allow functions to be overridden in derived classes. The virtual keyword before a function in the base class specifies that the function can be overridden. When a virtual function is called using a base class pointer, the version from the most derived class will be executed due to late binding. This allows runtime polymorphism where the function call is resolved based on the actual object type rather than the pointer variable type.
This document discusses polymorphism in C++. It defines polymorphism as the ability for functions or operators to have different meanings depending on the context. It describes different types of polymorphism including static and dynamic polymorphism. It then provides examples of method overloading, operator overloading, and virtual functions to illustrate polymorphism concepts in C++.
Inheritance allows new classes called derived classes to be created from existing classes called base classes. Derived classes inherit all features of the base class and can add new features. There are different types of inheritance including single, multilevel, multiple, hierarchical, and hybrid. A derived class can access public and protected members of the base class but not private members. Constructors and destructors of the base class are executed before and after those of the derived class respectively.
This document discusses data members and member functions in object-oriented programming. It defines data members as variables declared inside a class and member functions as functions declared inside a class. It covers accessing public, private, and protected data members, defining member functions inside and outside the class, and different types of member functions like static, const, inline, and friend functions. The document provides examples and explanations for each concept to help explain how data members and member functions work in object-oriented programming.
The document discusses classes and objects in C++. It defines a class as a collection of objects that have identical properties and behaviors. A class binds data and functions together. It then explains class declarations and definitions, access specifiers (private, public, protected), member functions defined inside and outside the class, arrays as class members, objects as function arguments, difference between structures and classes, and provides an example program to calculate simple interest using classes and objects.
This document provides an introduction to object-oriented programming (OOP) concepts using C++. It defines key OOP terms like class, object, encapsulation, inheritance, polymorphism and abstraction. It provides examples of different types of inheritance in C++ like single, multiple, hierarchical and hybrid inheritance. It also outlines advantages of OOP like easier troubleshooting, code reusability, increased productivity, reduced data redundancy, and flexible code.
This document discusses templates in C++. Templates allow functions and classes to work with multiple data types without writing separate code for each type. There are two types of templates: class templates, which define a family of classes that operate on different data types, and function templates, which define a family of functions that can accept different data types as arguments. Examples of each template type are provided to demonstrate how they can be used to create reusable and flexible code.
1) A friend function allows access to private and protected members of a class. It is declared inside the class using the keyword "friend".
2) A friend function is not a member function - it is defined outside of the class and does not have access to non-static members using the class object. However, it can access private and protected members of the class.
3) In the example, the Temperature class declares the temp function as a friend. This allows temp to directly access and modify the private celsius member, something that regular non-member functions cannot do. The friend declaration gives temp special access privileges.
The document discusses inline functions in C++. Inline functions allow code from a function to be pasted directly into the call site rather than executing a function call. This avoids overhead from calling and returning from functions. Good candidates for inline are small, simple functions called frequently. The document provides an example of a function defined with the inline keyword and the optimizations a compiler may perform after inlining. It also compares inline functions to macros and discusses where inline functions are best used.
- Java inner classes are classes declared within other classes or interfaces. They allow grouping of logically related classes and interfaces and can access all members of the outer class, including private ones.
- There are three main advantages of inner classes: they can access private members of the outer class, they make code more readable by grouping related classes, and they require less code.
- The two types of inner classes are non-static (inner) classes and static nested classes. Non-static classes can access outer class members like private variables while static classes cannot access non-static members only static ones.
- Examples demonstrate member inner classes, anonymous inner classes, local inner classes, and static nested classes in Java and how they can
The document provides an overview of object-oriented programming (OOP) concepts, including:
1. It discusses procedural programming and structured programming, and how OOP improved upon these approaches by emphasizing data rather than procedures. OOP focuses on representing real-world objects like menus and buttons through objects with both data and functions.
2. The core concepts of OOP are described - objects, classes, encapsulation, inheritance, polymorphism. An object contains both data (attributes) and code (methods) and is an instance of a class. Classes organize similar objects, and encapsulation binds data to methods within an object.
3. Advantages of OOP include modularity, code reusability
This document discusses the structure of a C++ program. It begins by defining software and the different types. It then discusses key concepts in C++ like classes, objects, functions, and headers. It provides examples of a class declaration with private and public sections, member functions, and a main function. It also discusses practical training resources available for learning C++ including e-learning websites, e-assignments, e-content, and mobile apps.
The document discusses inheritance in object-oriented programming using C++. It defines inheritance as a capability of one class to inherit properties from another class, with the class inheriting properties called the derived class and the class being inherited from called the base class. It describes single inheritance, multilevel inheritance, and different visibility modes (public, private, protected) that determine how members of the base class are accessible in the derived class. It provides examples of inheritance code in C++ to illustrate these concepts.
This document discusses string handling in C++. It defines a string as a collection of characters written in double quotation marks. Strings can be declared and initialized similarly to character arrays. The cin object and cin.getline() function can be used to input strings with or without spaces. Arrays of strings are two-dimensional character arrays that store multiple strings. Common string functions include memcpy() to copy characters, strcmp() to compare strings, strcpy() to copy one string to another, strlen() to find the length of a string, and strcat() to concatenate two strings.
The document discusses various topics related to computer networks including:
- Network types such as LANs, WANs, and MANs and their key differences.
- Common network topologies like star, bus, ring, and mesh.
- Typical network hardware components including nodes, servers, and different types of servers.
- Popular transmission mediums for networks such as twisted pair cable, coaxial cable, optical fiber, radio waves, satellites, and infrared transmission.
This document discusses function overloading, inline functions, and friend functions in C++. It defines function overloading as having two or more functions with the same name but different parameters, allowing for compile-time polymorphism. Inline functions have their body inserted at call sites for faster execution. Friend functions are non-member functions that have access to private members of a class. Examples are provided to demonstrate overloaded functions, inline functions checking for prime numbers, and using a friend function to check if a number is even or odd. Important concepts and questions for discussion are also outlined.
Here is a Python class with the specifications provided in the question:
class PICTURE:
def __init__(self, pno, category, location):
self.pno = pno
self.category = category
self.location = location
def FixLocation(self, new_location):
self.location = new_location
This defines a PICTURE class with three instance attributes - pno, category and location as specified in the question. It also defines a FixLocation method to assign a new location as required.
This document discusses multiple inheritance in C++. It defines multiple inheritance as a class inheriting from more than one base class. An example program is provided to demonstrate multiple inheritance, with a student class inheriting privately from both an info class and a result class. The document notes that multiple inheritance is useful when a derived class needs functionality from multiple base classes. It concludes with a summary of inheritance and its classifications.
Static Data Members and Member FunctionsMOHIT AGARWAL
Static data members and static member functions in C++ classes are shared by all objects of that class. Static data members are initialized to zero when the first object is created and shared across all instances, while static member functions can only access other static members and are called using the class name and scope resolution operator. The example program demonstrates a class with a static data member "count" that is incremented and accessed by multiple objects to assign increasing code values, and a static member function "showcount" that prints the shared count value.
Socat is a multi-purpose networking tool that can be used for tasks like port forwarding, attacking firewalls, and creating network connections between sockets, files, and devices. It allows for both manual configuration and programmatic control. Some applications of socat include using it as a chat server, creating reverse shells, generating keys, making certificates, and crafting packets.
The document discusses various data types in C++ including built-in, user-defined, and derived types. Structures and unions allow grouping of dissimilar element types. Classes define custom data types that can then be used to create objects. Enumerated types attach numeric values to named constants. Arrays define a collection of elements of the same type in sequence. Functions contain blocks of code to perform tasks. Pointers store memory addresses.
The document discusses dynamic memory allocation in C. It explains that dynamic allocation allows programs to obtain more memory while running or release unused memory. The main dynamic memory functions in C are malloc(), calloc(), free(), and realloc(). Malloc allocates memory, calloc allocates and initializes to zero, free deallocates memory, and realloc changes the size of allocated memory. Examples of using each function are provided.
An abstract class is a class that is declared abstract —it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed. When an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class.
C++ allows the common function to be made friendly with both the classes, thereby allowing the function to have access to the private data of these classes. Such a function need not be a member of any of these classes.
This document discusses function overloading, inline functions, and friend functions in C++. It defines function overloading as having two or more functions with the same name but different parameters. Inline functions have their body inserted at the call site instead of transferring control. Friend functions are non-member functions that have access to private members of a class. Examples are provided for each concept. The advantages of inline functions are reduced code size and faster execution, while disadvantages include increased file size and memory usage.
This document discusses function overloading, inline functions, and friend functions in C++. Function overloading allows functions to have the same name but different parameters, enabling polymorphism. Inline functions have their body inserted at call sites for efficiency. Friend functions can access private members of a class but are external functions without object access. Examples are provided to illustrate each concept.
1) A friend function allows access to private and protected members of a class. It is declared inside the class using the keyword "friend".
2) A friend function is not a member function - it is defined outside of the class and does not have access to non-static members using the class object. However, it can access private and protected members of the class.
3) In the example, the Temperature class declares the temp function as a friend. This allows temp to directly access and modify the private celsius member, something that regular non-member functions cannot do. The friend declaration gives temp special access privileges.
The document discusses inline functions in C++. Inline functions allow code from a function to be pasted directly into the call site rather than executing a function call. This avoids overhead from calling and returning from functions. Good candidates for inline are small, simple functions called frequently. The document provides an example of a function defined with the inline keyword and the optimizations a compiler may perform after inlining. It also compares inline functions to macros and discusses where inline functions are best used.
- Java inner classes are classes declared within other classes or interfaces. They allow grouping of logically related classes and interfaces and can access all members of the outer class, including private ones.
- There are three main advantages of inner classes: they can access private members of the outer class, they make code more readable by grouping related classes, and they require less code.
- The two types of inner classes are non-static (inner) classes and static nested classes. Non-static classes can access outer class members like private variables while static classes cannot access non-static members only static ones.
- Examples demonstrate member inner classes, anonymous inner classes, local inner classes, and static nested classes in Java and how they can
The document provides an overview of object-oriented programming (OOP) concepts, including:
1. It discusses procedural programming and structured programming, and how OOP improved upon these approaches by emphasizing data rather than procedures. OOP focuses on representing real-world objects like menus and buttons through objects with both data and functions.
2. The core concepts of OOP are described - objects, classes, encapsulation, inheritance, polymorphism. An object contains both data (attributes) and code (methods) and is an instance of a class. Classes organize similar objects, and encapsulation binds data to methods within an object.
3. Advantages of OOP include modularity, code reusability
This document discusses the structure of a C++ program. It begins by defining software and the different types. It then discusses key concepts in C++ like classes, objects, functions, and headers. It provides examples of a class declaration with private and public sections, member functions, and a main function. It also discusses practical training resources available for learning C++ including e-learning websites, e-assignments, e-content, and mobile apps.
The document discusses inheritance in object-oriented programming using C++. It defines inheritance as a capability of one class to inherit properties from another class, with the class inheriting properties called the derived class and the class being inherited from called the base class. It describes single inheritance, multilevel inheritance, and different visibility modes (public, private, protected) that determine how members of the base class are accessible in the derived class. It provides examples of inheritance code in C++ to illustrate these concepts.
This document discusses string handling in C++. It defines a string as a collection of characters written in double quotation marks. Strings can be declared and initialized similarly to character arrays. The cin object and cin.getline() function can be used to input strings with or without spaces. Arrays of strings are two-dimensional character arrays that store multiple strings. Common string functions include memcpy() to copy characters, strcmp() to compare strings, strcpy() to copy one string to another, strlen() to find the length of a string, and strcat() to concatenate two strings.
The document discusses various topics related to computer networks including:
- Network types such as LANs, WANs, and MANs and their key differences.
- Common network topologies like star, bus, ring, and mesh.
- Typical network hardware components including nodes, servers, and different types of servers.
- Popular transmission mediums for networks such as twisted pair cable, coaxial cable, optical fiber, radio waves, satellites, and infrared transmission.
This document discusses function overloading, inline functions, and friend functions in C++. It defines function overloading as having two or more functions with the same name but different parameters, allowing for compile-time polymorphism. Inline functions have their body inserted at call sites for faster execution. Friend functions are non-member functions that have access to private members of a class. Examples are provided to demonstrate overloaded functions, inline functions checking for prime numbers, and using a friend function to check if a number is even or odd. Important concepts and questions for discussion are also outlined.
Here is a Python class with the specifications provided in the question:
class PICTURE:
def __init__(self, pno, category, location):
self.pno = pno
self.category = category
self.location = location
def FixLocation(self, new_location):
self.location = new_location
This defines a PICTURE class with three instance attributes - pno, category and location as specified in the question. It also defines a FixLocation method to assign a new location as required.
This document discusses multiple inheritance in C++. It defines multiple inheritance as a class inheriting from more than one base class. An example program is provided to demonstrate multiple inheritance, with a student class inheriting privately from both an info class and a result class. The document notes that multiple inheritance is useful when a derived class needs functionality from multiple base classes. It concludes with a summary of inheritance and its classifications.
Static Data Members and Member FunctionsMOHIT AGARWAL
Static data members and static member functions in C++ classes are shared by all objects of that class. Static data members are initialized to zero when the first object is created and shared across all instances, while static member functions can only access other static members and are called using the class name and scope resolution operator. The example program demonstrates a class with a static data member "count" that is incremented and accessed by multiple objects to assign increasing code values, and a static member function "showcount" that prints the shared count value.
Socat is a multi-purpose networking tool that can be used for tasks like port forwarding, attacking firewalls, and creating network connections between sockets, files, and devices. It allows for both manual configuration and programmatic control. Some applications of socat include using it as a chat server, creating reverse shells, generating keys, making certificates, and crafting packets.
The document discusses various data types in C++ including built-in, user-defined, and derived types. Structures and unions allow grouping of dissimilar element types. Classes define custom data types that can then be used to create objects. Enumerated types attach numeric values to named constants. Arrays define a collection of elements of the same type in sequence. Functions contain blocks of code to perform tasks. Pointers store memory addresses.
The document discusses dynamic memory allocation in C. It explains that dynamic allocation allows programs to obtain more memory while running or release unused memory. The main dynamic memory functions in C are malloc(), calloc(), free(), and realloc(). Malloc allocates memory, calloc allocates and initializes to zero, free deallocates memory, and realloc changes the size of allocated memory. Examples of using each function are provided.
An abstract class is a class that is declared abstract —it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed. When an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class.
C++ allows the common function to be made friendly with both the classes, thereby allowing the function to have access to the private data of these classes. Such a function need not be a member of any of these classes.
This document discusses function overloading, inline functions, and friend functions in C++. It defines function overloading as having two or more functions with the same name but different parameters. Inline functions have their body inserted at the call site instead of transferring control. Friend functions are non-member functions that have access to private members of a class. Examples are provided for each concept. The advantages of inline functions are reduced code size and faster execution, while disadvantages include increased file size and memory usage.
This document discusses function overloading, inline functions, and friend functions in C++. Function overloading allows functions to have the same name but different parameters, enabling polymorphism. Inline functions have their body inserted at call sites for efficiency. Friend functions can access private members of a class but are external functions without object access. Examples are provided to illustrate each concept.
1. The document discusses various concepts related to functions in C++ such as function prototypes, passing arguments by reference, default arguments, inline functions, function overloading, and friend functions.
2. It provides examples to explain concepts like passing arguments by reference allows altering the original variable values, a friend function can access private members of a class, and function overloading allows using the same function name for different tasks based on the argument types.
3. The key benefits of concepts like inline functions, passing by reference, and function overloading are also summarized.
This document provides an overview of object-oriented programming (OOP) concepts in C++. It defines key OOP concepts like class, object, inheritance, encapsulation, abstraction, polymorphism, and overloading. It provides examples to illustrate class and object, inheritance with different types, encapsulation by hiding data, and function overloading. The document was prepared by a trainee as part of a mentoring program and provides contact information for the training organization.
Polymorphism refers to having many forms. There are two types of polymorphism: compile-time polymorphism and runtime polymorphism. Compile-time polymorphism includes function overloading and operator overloading, where functions with the same name but different parameters are resolved at compile-time. Runtime polymorphism is achieved through method overriding using virtual functions, where the function called is resolved at runtime based on the object type. This allows a base class pointer to call derived class functions.
This code will generate a compile time error as Base is an abstract class due to pure virtual function show(). An abstract class cannot be instantiated.
The document provides an overview of object-oriented programming concepts in C++. It discusses key OOP concepts like objects, classes, encapsulation, inheritance and polymorphism. It also covers procedural programming in C++ and compares it with OOP. Examples are provided to demonstrate creating classes, objects, functions, constructors and destructors. The document contains information on basic C++ programming concepts needed to understand and implement OOP principles in C++ programs.
This document provides an introduction to C++ and covers 10 topics: 1) Object-oriented programming principles, 2) Classes and objects, 3) Functions, 4) Constructors and destructors, 5) Operator overloading and type conversion, 6) Inheritance, 7) Pointers, virtual functions and polymorphism, 8) Working with files, 9) Templates, and 10) Exception handling. Each topic is briefly described in 1-2 paragraphs with examples provided for some concepts like encapsulation, inheritance, polymorphism, and exception handling. The document serves as a high-level overview of key C++ concepts and features.
This document provides an overview of object-oriented programming concepts in C++ including polymorphism, virtual functions, pure virtual functions, abstract classes, and pointers to objects. It defines each concept, provides syntax examples, and short programs to demonstrate how each concept works in practice. The document is submitted as part of a programming fundamentals course by Sidra Tahir to her instructor at COVT Post Graduate College for Women in Lahore, Pakistan.
The document is a test paper for the course CS2311 - Object-Oriented Programming at PERI INSTITUTE OF TECCHNOLOGY. It contains 15 questions testing concepts related to OOP such as classes, objects, inheritance, polymorphism, operator overloading, templates, and exception handling. It also includes questions about file handling and formatted I/O functions in C++. The test has a duration of 180 minutes and is worth a maximum of 100 marks, divided into multiple choice questions worth 2 marks each (Part A) and longer answer questions worth 16 marks each (Part B).
Comparison between runtime polymorphism and compile time polymorphismCHAITALIUKE1
Comparison between runtime polymorphism and compile time polymorphism -
Certainly! Here's a short description of the comparison between runtime polymorphism and compile-time polymorphism in a PowerPoint presentation (PPT):
Slide 1: Title
Title: "Comparison: Runtime Polymorphism vs. Compile-Time Polymorphism"
Slide 2: Introduction
Introduction to polymorphism.
Mention that polymorphism is a fundamental concept in object-oriented programming.
Slide 3: Compile-Time Polymorphism
Define Compile-Time Polymorphism.
Highlight that it's also known as Static or Early Binding Polymorphism.
Explain that it's resolved during compile-time.
Provide examples like function overloading.
Slide 4: Runtime Polymorphism
Define Runtime Polymorphism.
Highlight that it's also known as Dynamic or Late Binding Polymorphism.
Explain that it's resolved during runtime.
Provide examples like method overriding.
Slide 5: Key Differences
List the key differences between compile-time and runtime polymorphism.
Differences might include resolution time, method signatures, and performance implications.
Slide 6: Use Cases
Explain when to use compile-time polymorphism.
Provide scenarios where it's beneficial.
Slide 7: Use Cases (Cont.)
Explain when to use runtime polymorphism.
Provide scenarios where it's beneficial.
Slide 8: Pros and Cons
List the advantages and disadvantages of compile-time polymorphism.
List the advantages and disadvantages of runtime polymorphism.
Slide 9: Performance Comparison
Compare the performance aspects of both types of polymorphism.
Discuss factors like execution speed and memory usage.
Slide 10: Conclusion
Summarize the main points.
Suggest when to use each type of polymorphism based on the application's requirements
The document discusses function overloading in C++ and provides an example program to calculate the area of different shapes using function overloading. It then discusses constructors and destructors with examples and explains polymorphism with an example. Next, it discusses different types of inheritance in C++ and provides an example program to implement operator overloading for a distance class. It also discusses virtual functions with an example and access specifiers in classes. Finally, it provides examples to define a student class, implement quicksort using templates and overloading relational operators.
C/C++ Programming interview questions and answers document discusses key concepts in C++ including encapsulation, inheritance, polymorphism, constructors, destructors, copy constructors, references, virtual functions, abstract classes, and memory alignment. The document provides definitions and examples to explain each concept.
In this presentation we will show irrefutable evidence that proves the existence of Pope Joan, who became pontiff in 856 BC and died giving birth in the middle of a procession in 858 BC.
Order Lepidoptera: Butterflies and Moths.pptxArshad Shaikh
Lepidoptera is an order of insects comprising butterflies and moths. Characterized by scaly wings and a distinct life cycle, Lepidoptera undergo metamorphosis from egg to larva (caterpillar) to pupa (chrysalis or cocoon) and finally to adult. With over 180,000 described species, they exhibit incredible diversity in form, behavior, and habitat, playing vital roles in ecosystems as pollinators, herbivores, and prey. Their striking colors, patterns, and adaptations make them a fascinating group for study and appreciation.
The Ellipsis Manual Analysis And Engineering Of Human Behavior Chase Hughespekokmupei
The Ellipsis Manual Analysis And Engineering Of Human Behavior Chase Hughes
The Ellipsis Manual Analysis And Engineering Of Human Behavior Chase Hughes
The Ellipsis Manual Analysis And Engineering Of Human Behavior Chase Hughes
Research Handbook On Environment And Investment Law Kate Milesmucomousamir
Research Handbook On Environment And Investment Law Kate Miles
Research Handbook On Environment And Investment Law Kate Miles
Research Handbook On Environment And Investment Law Kate Miles
Drug Metabolism advanced medicinal chemistry.pptxpharmaworld
This document describes about structural metabolism relationship and drug designing and toxicity of drugs in " DRUG METABOLISM"
In Drug Metabolism is the process of converting a drug into product or inert substances after or before reaching at the site of action.
Metabolism plays an important role in elimination of drugs and foreign substance from the body.
The metabolism of any drug is generally characterised by two phases of reaction
1.Metabolic transformation ( biotransformation ) and
2.Conjugation
The Principal site of drug metabolism is the liver, but the kidney, lungs, and GIT also are important metabolic sites.
The enzymatic bio transformations of drugs is known as Drug Metabolism. Because many drugs have structures similar to those of endogenous compounds , drugs may get metabolised by specific enzymes for the related natural substrates as well as by non-specific enzymes.
Reaction type of Phase-I:
1.Oxidation
2.Reduction
3.Hydrolysis
Most drugs are metabolised ,atleast to some extent , by both phases of metabolism.
Example: Metabolism of Aspirin
Acetyl Salicylic acid undergoes hydrolysis to salicylic acid ( metabolic transformation ), which is then conjugated with glycine to form Salicyluric acid ( Conjugation ).
In Phase-II the metabolites formed in Phase-II are converted to more polar and water soluble product by attaching polar and ionisable moiety such as
1.Glucuronic acid
2.Glycine
3.Glutamine
4.Glutathione conjugation
5.Acetylation
6.Methylation
7.Sulfate conjugation
8.Nucleoside and Nucleotide formation
9.Amino Acid Conjugation
10.Fatty Acid and Cholesterol Conjugation
Drug design is the process of creating new drugs by using knowledge of a biological target.
Drug design considers metabolism to optimize pharmaco kinects ( ADME: Absorption , Distribution , Metabolism , Excretion )
Cytochrome CYP450 enzyme in Drug Metabolism is vital in drug design to enhance efficacy , reduce toxicity and improve bioavailability.
Cytochrome P450 enzymes (CYPs) are a superfamily of heme -containing proteins found from bacteria to human.
Cytochrome P-450 activity in various organs like Liver,Lung ,Kidney , Intestine,Placenta
Adrenal and Skin and they shows the relative activity with repect to their organs in the process of drug metabolism.
Most important CYP450 enzymes are CYP1A2 , CYP2C9 , CYP2E1
,etc...
Toxic Effects of Drug Metabolism
Toxicity: Accumulation of Excess of medications in the Blood Stream.
Ariens (1948) and Mitchell and Horning (1984) deal with this topic.
Some examples of Metabolism-Linked Toxicity are
1.Acetaminophen (paracetmol)
2.Isoniazid ( TB drug)
3.Chloroform
4.Dapsone
5.Diazepam
6.Salicylate
7.Halothane (Anesthetic)
8.Tamoxifen (Breast Cancer drug )
9.Clozapine(Antipsychotic)
These drugs are differentiates with the TOXIC METABOLITE , TOXICITY OF METABOLITE.
References for this topic also mentioned at the end.
How to Use Owl Slots in Odoo 17 - Odoo SlidesCeline George
In this slide, we will explore Owl Slots, a powerful feature of the Odoo 17 web framework that allows us to create reusable and customizable user interfaces. We will learn how to define slots in parent components, use them in child components, and leverage their capabilities to build dynamic and flexible UIs.
Flower Identification Class-10 by Kushal Lamichhane.pdfkushallamichhame
This includes the overall cultivation practices of rose prepared by:
Kushal Lamichhane
Instructor
Shree Gandhi Adarsha Secondary School
Kageshowri Manohara-09, Kathmandu, Nepal
How to Configure Subcontracting in Odoo 18 ManufacturingCeline George
Subcontracting in manufacturing involves outsourcing specific production tasks to external vendors or subcontractors. These tasks may include manufacturing certain components, handling assembly processes, or even producing entire product lines.
Protest - Student Revision Booklet For VCE Englishjpinnuck
The 'Protest Student Revision Booklet' is a comprehensive resource to scaffold students to prepare for writing about this idea framework on a SAC or for the exam. This resource helps students breakdown the big idea of protest, practise writing in different styles, brainstorm ideas in response to different stimuli and develop a bank of creative ideas.
TechSoup Microsoft Copilot Nonprofit Use Cases and Live Demo - 2025.05.28.pdfTechSoup
In this webinar we will dive into the essentials of generative AI, address key AI concerns, and demonstrate how nonprofits can benefit from using Microsoft’s AI assistant, Copilot, to achieve their goals.
This event series to help nonprofits obtain Copilot skills is made possible by generous support from Microsoft.
How to create and manage blogs in odoo 18Celine George
A blog serves as a space for sharing articles and information.
In Odoo 18, users can easily create and publish blogs through
the blog menu. This guide offers step-by-step instructions on
setting up and managing a blog on an Odoo 18 website.
Principal Satbir Singh writes “Kaba and Kitab i.e. Building Harmandir Sahib and Compilation of Granth Sahib gave Sikhs a central place of worship and a Holy book is the single most important reason for Sikhism to flourish as a new religion which gave them a identity which was separate from Hindu’s and Muslim’s.
2nd puc computer science chapter 8 function overloading
1. 1 YouTube channel: study with me Ashwini e
Ashwini E [email protected]
CHAPTER 8
FUNCTION OVERLOADING
Polymorphism is one of the main concepts of object oriented programming. Poly means many, and morph
means form. So Polymorphism is many formed.
There are two types of Polymorphism- Compile time polymorphism and Run time polymorphism.
Compile time polymorphism- in this type, code associated with a function call is known at the compile
time itself. Ex: Function overloading and operator overloading.
Runtime polymorphism- in this type, the code associated with the function call is known only during run
time(execution time). It is also known as Dynamic binding.
Function overloading:
The process of using same function name but different number and type of arguments to perform
different tasks is known as function overloading.
Function signature:
Argument list of a function that gives the number of arguments and types of arguments is called Function
signature.
Two functions are said to have same function signature if they use same number of arguments and type of
arguments. Function name can be different.It doesnot include return type of function.
Ex:
void function2(int x,float y,char ch);
void function5(int a,float b,char c); //function2() and function5() have same signature
Declaration and definition of function overloading:
To overload a function, we must have
1. Function names should be similar
2. All the functions should have different signatures.
Example: a sum() function to find sum of integers, real numbers and double.
In the above question, three member functions are needed.
int sum(int,int);
float sum(float,float);
double sum(double,double);
When functions are overloaded, compiler determines which function has to be executed based on
the number and type of arguments.
void SUM(int x, double y);
int SUM(int x,double y);
//generates syntax error because number.of arguments and their datatypes are same.
2. 2 YouTube channel: study with me Ashwini e
Ashwini E [email protected]
//program using function overloading without class
#include<iostream.h>
void display(int);
void display(float);
void display(char);
void main()
{
int a;
float b;
char c;
clrscr();
a=10;
b=45.78;
c=’&’;
display(a);
display(b);
display(c);
getch();
}
void display(int x)
{
cout<<”integer value=”<<x<<endl;
}
void display(float y)
{
cout<<”Real number=”<<y<<endl;
}
void display(char z)
{
cout<<”Character=”<<x<<endl;
}
//program using function overloading with class
#include<iostream.h>
int AREA(int);
int AREA(int,int);
float AREA (float,float);
class funcoverload
{
public:
int area(int s)
{
return(s*s);
}
int area(int l,int w)
{
3. 3 YouTube channel: study with me Ashwini e
Ashwini E [email protected]
return(l*w);
}
float area(float b,float h)
{
return(0.5*b*h);
}
};
void main()
{
funcoverload f; //creating object f
clrscr();
f.area(6); //accessing member function and passing integer value as argument
f.area(10,12);
f.area(3.5,6.8);
getch();
}
Advantages of function overloading:
1. Eliminates the use of different function names for same operation.
2. Helps to understand and debug easily
3. Easy to maintain code. Any changes can be made easy.
4. Better understanding of the relation between program and outside world.
5. Reduces complexity of program
Inline functions
Functions are used to save memory space but it creates overhead( passing arguments, returning values,
storing address of next instruction in calling function etc). To reduce the overhead and to increase the
speed of program execution, a new type of function is introduced--- INLINE function.
Inline function is a function whose function body is inserted at the place of function
call.
The compiler replaces the function call with the corresponding function body
Inline function increases the efficiency and speed of execution of program. But more memory is
needed if we call inline function many times.
Inline function definition is similarto a function definition but keyword inline precedes the
function name. It should be given before all functions that call it.
Syntax:
inline returntype functionname(argumentlist)
{
…………………………………………
return(expression);
}
Inline function is useful when calling function is small and straight line code with few
statements. No loops or branching statements are allowed.
Advantages:
4. 4 YouTube channel: study with me Ashwini e
Ashwini E [email protected]
1. Very efficient code can be generated.
2. Readability of program increase
3. Speed of execution of program increases
4. Size of object code is reduced
Disadvantage:
1. As function body is replaced in place of function call, the size of executable file increase and
more memory is needed.
Ex: Find cube of a number using inline function
#include<iostream.h>
inline double CUBE(double a)
{
return(a*a*a);
}
void main()
{
double n;
cout<<”enter a number”<<endl;
cin>>n;
cout<<”Cube of “<<n<<”=”<<CUBE(n);
getch();
}
Situations where inline functions may not work:
1. When inline function definition is to long or complicated
2. When inline functionis recursive.
3. When inline function has looping constructs
4. When inline function has switch or any branching statements or goto
Friend function:
Friend function is a non member function that can access the private and protected data
members of a class.
FUNCTION()
Friend function definition
Friend function declaration
Features of Friend function:
private
protected
Data or function
Data or function
friend FUNCTION();
………………………………………..
………………………………………………
……………………………………………..
Class A
5. 5 YouTube channel: study with me Ashwini e
Ashwini E [email protected]
• Keyword friend must precede the friend function declaration.
• Friend function is a non member function of a class
• It can access private and protected members of a class
• It is declared inside a class and can be defined inside or outside the class. Scope resolution
operator is not needed to access friend function outside the class.
• It receives objects of the class as arguments
• It can be invoked like a normal function without using any object
• It cannot access data member directly. It has to use object name and dot membership operator
with each member name.
• It can be declared either in public or private part of a class.
• Use of friend function is rare since it violates the rule of encapsulation and data hiding.
Ex: Program to find average of two numbers using friend function
#include<iostream.h>
class Sample
{
private:
int a,b;
public:
void readdata()
{
cout<<”enter value of a and b”<<endl;
cin>>a>>b;
}
friend float average(Sample s); //declaring friend function with object as argument
};
float average(Sample s) //defining friend function
{
return((s.a+s.b)/2.0) //accessing member a and b using object & dot operator
}
void main()
{
Sample x; //creating object
x.readdata();
cout<<”average value=”<<average(x) <<”n”; //calling friend function
}
A friend function can be used as a bridge between two classes.
#include<iostream.h>
class wife; //forward declaration that tells the compiler about classname before declaring it
class husband
{
private:
char name[20];
int salary;
public:
void readdata()
6. 6 YouTube channel: study with me Ashwini e
Ashwini E [email protected]
{
cout<<”input husband name”;
cin>> name;
cout<<input husband salary”;
cin>>salary;
}
friend int totalsalary(husband,wife);
}; //end of class husband
class wife
{
private:
char name[20];
int salary;
public:
void readdata()
{
cout<<enter wife name”
cin>>name;
cout<<enter wife salary”;
cin>>salary;
}
friend int totalsalary(husband,wife);
}; //end of class wife
int totalsalary(husband h,wife w)
{
return(h.salary+w.salary);
}
void main()
{
husband h;
wife w;
h.readdata();
w.readdata();
cout<<”total salary of the family is “<<totalsalary(h,w);
}
********************************
function over loading (32 question)
1What is a friend function? Write the characteristics of a friend
function.[2019]
2Define function overloading. Mention its advantages.[2019s]
7. 7 YouTube channel: study with me Ashwini e
Ashwini E [email protected]
3 Discuss overloaded functions with an example.[2018s]
4 Explain friend function with syntax and programming example.
[2018]
5 When function overloading is needed? Write any two advantages and
restrictions on overloading functions[2017s]
6 Explain inline function with programming example.[2017] [2015]
7 What are the advantages and disadvantages of inline
function?[2016s]
8 Describe briefly the use of friend function in C++ with syntax and
example.[2016]
9 What is function overloading? Explain the need for
overloading.[2015s][2020]