Search
 
SCRIPT & CODE EXAMPLE
 

CPP

template design pattern

#include<iostream>

class BaseClass abstract {
protected:
	virtual void someMethod() = 0;
public:
	void ThisIsTemplateMethod() { someMethod(); }
};

class ExtendedClass_one : public BaseClass {
	void someMethod() override {
		puts("[ExtendedClass_one] Re-Define method here.");
	}
};
class ExtendedClass_two : public BaseClass {
	void someMethod() override {
		puts("[ExtendedClass_two] Re-Define method here.");
	}
};

int main() {

	BaseClass* one = new ExtendedClass_one;
	one->ThisIsTemplateMethod();

	BaseClass* two = new ExtendedClass_two;
	two->ThisIsTemplateMethod();

	return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: xor in c++ 
Cpp :: result += a +b in c++ meaning 
Cpp :: what are manipulators in c++ 
Cpp :: how to show c++ binary files in sublime text 
Cpp :: c++ rgb code 
Cpp :: 1047. Remove All Adjacent Duplicates In String solution leetcode in c++ 
Cpp :: declare static table filled cpp 
Cpp :: run a c++ file in terminal 
Cpp :: c++ how to iterate through 2d array in c++ 
Cpp :: pass address to function c++ 
Cpp :: ‘npos’ is not a member of ‘std’ 
Cpp :: how to traverse string like array in cpp 
Cpp :: arduino jumper programmieren 
Cpp :: minimum no of jump required to reach end of arry 
Cpp :: 5 program code in c++ of friend function 
Cpp :: Chef and IPC Certificates codechef solution in c++ 
Cpp :: constant qualifier c++ "error display" 
Cpp :: MPI_File_seek 
Cpp :: simple interest rate 
Cpp :: a variable with 2 independant variables plot 
Cpp :: http://dcnet.ddns.ma/Connecter_Tuteur 
Cpp :: opengl triangle example 
Cpp :: c++ shift array to the right 
Cpp :: C++ Area and Circumference of a Circle 
Cpp :: trig in c++ 
Cpp :: c++ error 0xC0000005 
C :: c colour text 
C :: buble sort c 
C :: imprimir valor no octave 
C :: c data types 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =